PHP as fast as possible.
This software is a super lightweight RESTful framework for your future PHP code base. Every attempt has been made to make it as fast as possible. For best performance it's recommended that you install the latest PHP with opcache enabled as documented below.
- Setup PHP Redis Extension
- Setup PHP Stemming Extension
- Setup GraphicsMagick with PHP Extension
- Setup FFMPEG
Required:
Optional (gives full features):
- Redis v2.8.3+ with phpredis PHP Extension
- PHP Zend OPcache extension
- PHP GD extension
- PHP PDO extension with pdo-mysql and pdo-pgsql
- PHP cURL extension
- MySQL v5.6.15+
Use a server clause similar to this one, replace with your server information.
server {
listen <ip address:port number>;
server_name <ip:port or domain name>;
root <path to soarin folder>/public;
rewrite ^([^.]*[^/])$ $1/ permanent;
# remove when in 'production'
location ~ \.(jpg|jpeg|png|apng|gif|swf|ico|txt|html|htm|js|css|less|eot|svg|ttf|woff)$ {
root /;
try_files <path to soarin folder>/php/app/$uri <path to soarin folder>/public/$uri 404.php;
}
location / {
index index.php;
if (!-f $request_filename) {
rewrite ^(.*)$ /index.php last;
}
}
location ~ \.php$ {
include /opt/nginx/conf/fastcgi.conf;
fastcgi_index index.php;
if (-f $request_filename) {
fastcgi_pass 127.0.0.1:9000;
}
}
location ~ \.flv$ {
flv;
}
location ~ \.mp4$ {
mp4;
}
}
The NGINX web server used for this project was configured with these options
./configure \
--prefix=/opt/nginx \
--with-pcre \
--with-http_ssl_module \
--with-http_flv_module \
--with-http_realip_module \
--with-http_mp4_module \
--with-mail
Required Debian packages: gcc libpcre3 libpcre3-dev zlib1g zlib1g-dev openssl libssl-dev
PHP was compiled for this project using these configuration options
./configure \
--prefix=/opt/php \
--with-mysql=shared,/opt/mysql/server-5.6 \
--with-pgsql=/var/lib/postgresql/9.3/main \
--with-jpeg-dir \
--with-pdo-mysql \
--with-pdo-pgsql \
--with-mysqli \
--with-curl \
--enable-exif \
--with-gd \
--enable-mbstring \
--enable-pdo \
--enable-sockets \
--enable-fpm \
--with-pear \
--with-pspell=/usr \
--enable-opcache
Required Debian packages: libxml2-dev libcurl4-gnutls-dev libpng12-0 libpng12-dev libjpeg62 libjpeg62-dev libpq-dev aspell libaspell15 libaspell-dev libpspell-dev
Note: to enable opcache you must add "zend_extension=opcache.so" to your PHP.INI file
Grunt is included with scripts to auto-compile/minify your project's /php/styles/ files (css/less/javascript/js libraries)
- Install node
- Install Grunt global npm package by running command
npm install -g grunt-cli
- Move into framework's Grunt folder
<framework path>/php/grunt/
- Install the Grunt dependencies, run command
npm install
- Run Soarin Grunt script by typing
grunt
Directory structure of Soarin
Path Description Constant ---- ----------- -------- . ├── php parent folder for internal files │ │ │ ├── app your application folder APP │ │ │ │ │ ├── controllers Controllers folder CONTROLLERS │ │ │ │ │ ├── models Models folder MODELS │ │ │ │ │ ├── routes application config folder │ │ │ │ │ │ │ ├── errors.php Error code handling file │ │ │ └── routes.php Router configuration file │ │ │ │ │ ├── styles Frontend styles folder STYLES │ │ │ │ │ │ │ ├── images static file folder │ │ │ ├── js JS file folder │ │ │ ├── less LESS(CSS) file folder │ │ │ ├── libraries JS Libraries folder │ │ │ └── autoload.json library autoload config file │ │ │ │ │ └── views Views folder VIEWS │ │ │ ├── grunt grunt script folder (code optimizer) │ │ │ ├── logs log files folder │ │ │ └── php-libraries php libraries folder LIBRARIES │ │ │ └── soarin the soarin framework folder (internals) SOARIN │ │ │ └── config.php Soarin config variables file │ └── public parent folder for public web files │ ├── 404.html 404 file └── index.php entry point file