Browse Source

adding PIMF php micro framework

gjerokrsteski 11 years ago
parent
commit
a439641a31

+ 18 - 0
php-pimf/.editorconfig

@@ -0,0 +1,18 @@
+; top-most EditorConfig file
+root = true
+
+; Unix-style newlines
+[*]
+end_of_line = LF
+
+[*.php]
+indent_style = space
+indent_size = 2
+
+[*.test]
+indent_style = space
+indent_size = 2
+
+[*.rst]
+indent_style = space
+indent_size = 2

+ 1 - 0
php-pimf/.gitattributes

@@ -0,0 +1 @@
+* text=auto

+ 30 - 0
php-pimf/.gitignore

@@ -0,0 +1,30 @@
+# OS or Editor folders
+.DS_Store
+Thumbs.db
+.cache
+.project
+.settings
+.tmproj
+*.esproj
+nbproject
+
+# Numerous always-ignore extensions
+*.diff
+*.err
+*.orig
+*.log
+*.rej
+*.swo
+*.swp
+*.vi
+*~
+*.sass-cache
+
+# Folders to ignore
+.hg
+.svn
+.CVS
+intermediate
+publish
+.idea
+pimf-framework

+ 3 - 0
php-pimf/.gitmodules

@@ -0,0 +1,3 @@
+[submodule "pimf-framework"]
+	path = pimf-framework
+	url = https://github.com/gjerokrsteski/pimf-framework.git

+ 20 - 0
php-pimf/.htaccess

@@ -0,0 +1,20 @@
+# Apache configuration file
+# http://httpd.apache.org/docs/2.2/mod/quickreference.html
+
+# Note: ".htaccess" files are an overhead for each request. This logic should
+# be placed in your Apache config whenever possible.
+# http://httpd.apache.org/docs/2.2/howto/htaccess.html
+
+# For all files not found in the file system, reroute the request to the
+# "index.php" front controller, keeping the query string intact
+
+<IfModule mod_rewrite.c>
+  RewriteEngine On
+  RewriteCond %{REQUEST_FILENAME} !-f
+  RewriteRule ^ index.php [QSA,L]
+</IfModule>
+
+<Files config.php>
+  order allow,deny
+  deny from all
+</Files>

+ 45 - 0
php-pimf/README.md

@@ -0,0 +1,45 @@
+# PIMF Benchmarking Test
+
+This is the PIMF portion of a [benchmarking test suite](../) comparing a variety of web development platforms.
+
+### JSON Encoding Test
+Uses the PHP standard [JSON encoder](http://www.php.net/manual/en/function.json-encode.php).
+
+* [JSON test controller](/app/Vanilla/Controller/Hello.php)
+
+
+### Data-Store/Database Mapping Test
+Uses the PIMF PDO Entity-Manager.
+
+* [DB test controller](/app/Vanilla/Controller/Hello.php)
+
+### Template Test
+Uses PIMF plain vanilla PHTML rendering
+
+* [Template test controller](/app/Vanilla/Controller/Hello.php)
+
+
+## Infrastructure Software Versions
+The tests were run with:
+
+* [PIMF Version 1.8.6](http://pimf-framework.de/)
+* [PHP Version 5.4.13](http://www.php.net/) with FPM and APC
+* [nginx 1.4.0](http://nginx.org/)
+* [MySQL 5.5.29](https://dev.mysql.com/)
+
+## Test URLs
+### JSON Encoding Test
+
+http://localhost/json
+
+### Data-Store/Database Mapping Test
+
+http://localhost/db
+
+### Variable Query Test
+    
+http://localhost/db?queries=2
+
+### Templating Test
+
+http://localhost/fortunes

+ 0 - 0
php-pimf/__init__.py


+ 106 - 0
php-pimf/app/Vanilla/Controller/Hello.php

@@ -0,0 +1,106 @@
+<?php
+namespace Vanilla\Controller;
+
+use Pimf\Controller\Base, Pimf\View, Pimf\Registry;
+
+class Hello extends Base
+{
+  /**
+   * A index action - this is a framework restriction!
+   */
+  public function indexAction()
+  {
+    $this->jsonAction();
+  }
+
+  /**
+   * Test 1: JSON serialization
+   */
+  public function jsonAction()
+  {
+    $this->response->asJSON()->send(array("message" => "Hello World!"));
+  }
+
+  /**
+   * Test 2: Multiple database queries
+   */
+  public function queriesAction()
+  {
+    $queries = max(1, min($this->request->fromGet()->get('queries', 1), 500));
+
+    $worlds = array();
+
+    for ($i = 0; $i < (int)$queries; ++$i) {
+      $worlds[] = Registry::get('em')->world->find(mt_rand(1, 10000));
+    }
+
+    $this->response->asJSON()->send($worlds);
+  }
+
+  /**
+   * Test 3: Single database query
+   */
+  public function dbAction()
+  {
+    $worlds = Registry::get('em')->world->find(1);
+
+    $this->response->asJSON()->send($worlds);
+  }
+
+  /**
+   * Test 4: Fortunes
+   */
+  public function fortunesAction()
+  {
+    $templates = array();
+    $fortunes = Registry::get('em')->fortune->getAll();
+    $fortunes[] = 'Additional fortune added at request time.';
+
+    asort($fortunes);
+
+    foreach ($fortunes as $i => $fortune) {
+        $templates[$i] = '<tr><td>'.$i.'</td><td>'.$fortune.'</td></tr>';
+    }
+
+    $this->response->asHTML()->send(
+      '<!DOCTYPE html><html><head><title>Fortunes</title></head><body><table><tr><th>id</th><th>message</th></tr>'.implode('', $templates).'</table></body></html>'
+    );
+  }
+
+  /**
+   * Test 5: Database updates
+   */
+  public function updatesAction()
+  {
+    $queries = max(1, min($this->request->fromGet()->get('queries', 1), 500));
+
+    $worlds = array();
+
+    /* @var $em \Pimf\EntityManager */
+    $em = Registry::get('em');
+
+    $em->beginTransaction();
+
+    for ($i = 0; $i < (int)$queries; ++$i) {
+      $worlds[] = $em->world->find(mt_rand(1, 10000));
+    }
+
+    foreach ($worlds as $i => $row) {
+      $row[$i]['randomNumber'] = rand(1, 10000);
+      $em->world->update($row);
+    }
+
+    $em->commitTransaction();
+
+    $this->response->asJSON()->send($worlds);
+
+  }
+
+  /**
+   * Test 6: Plaintext
+   */
+  public function plaintextAction()
+  {
+    $this->response->asTEXT()->send('Hello World!');
+  }
+}

+ 19 - 0
php-pimf/app/Vanilla/DataMapper/Fortune.php

@@ -0,0 +1,19 @@
+<?php
+namespace Vanilla\DataMapper;
+
+use Pimf\DataMapper\Base;
+
+class Fortune extends Base
+{
+  /**
+   * @return array
+   */
+  public function getAll()
+  {
+    $sth = $this->pdo->prepare('SELECT * FROM Fortune');
+    $sth->execute();
+
+    return $sth->fetchAll();
+  }
+}
+ 

+ 37 - 0
php-pimf/app/Vanilla/DataMapper/World.php

@@ -0,0 +1,37 @@
+<?php
+namespace Vanilla\DataMapper;
+
+use Pimf\DataMapper\Base;
+
+class World extends Base
+{
+  /**
+   * @param integer $id
+   *
+   * @return array
+   */
+  public function find($id)
+  {
+    $sth = $this->pdo->prepare('SELECT * FROM World WHERE id = :id');
+
+    $sth->bindValue(':id', $id, \PDO::PARAM_INT);
+    $sth->execute();
+
+    return (array) $sth->fetch();
+  }
+
+  /**
+   * @param array $world
+   *
+   * @return bool
+   */
+  public function update(array $world)
+  {
+    $sth = $this->pdo->prepare('UPDATE World SET randomNumber = :randomNumber WHERE id = :id');
+
+    $sth->bindValue(':randomNumber', $world['randomNumber'], \PDO::PARAM_INT);
+    $sth->bindValue(':id', $world['id'], \PDO::PARAM_INT);
+
+    return $sth->execute();
+  }
+}

+ 10 - 0
php-pimf/app/Vanilla/routes.php

@@ -0,0 +1,10 @@
+<?php
+return array(
+  new \Pimf\Route('/', array('controller' =>'hello', 'action' => 'index')),
+  new \Pimf\Route('/json', array('controller' =>'hello', 'action' => 'json')),
+  new \Pimf\Route('/queries', array('controller' =>'hello', 'action' => 'queries')),
+  new \Pimf\Route('/db', array('controller' =>'hello', 'action' => 'db')),
+  new \Pimf\Route('/fortunes', array('controller' =>'hello', 'action' => 'fortunes')),
+  new \Pimf\Route('/updates', array('controller' =>'hello', 'action' => 'updates')),
+  new \Pimf\Route('/plaintext', array('controller' =>'hello', 'action' => 'plaintext')),
+);

+ 37 - 0
php-pimf/app/autoload.app.php

@@ -0,0 +1,37 @@
+<?php
+/*
+|--------------------------------------------------------------------------
+| Your Application's PHP classes auto-loading
+|
+| All classes in PIMF are statically mapped. It's just a simple array of
+| class to file path maps for ultra-fast file loading.
+|--------------------------------------------------------------------------
+*/
+spl_autoload_register(
+  function ($class) {
+
+    // *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
+    // FEEL FREE TO CHANGE THE MAPPINGS AND DIRECTORIES
+    // *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
+
+    /**
+     * The mappings from class names to file paths.
+     */
+    static $mappings = array(
+      'Vanilla\\Controller\\Hello'   => '/Vanilla/Controller/Hello.php',
+      'Vanilla\\DataMapper\\Fortune' => '/Vanilla/DataMapper/Fortune.php',
+      'Vanilla\\DataMapper\\World'   => '/Vanilla/DataMapper/World.php',
+    );
+
+    // *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
+    //  END OF USER CONFIGURATION!!!
+    // *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
+
+    // load the class from the static heap of classes.
+    if (isset($mappings[$class])) {
+      return require __DIR__ . DIRECTORY_SEPARATOR . $mappings[$class];
+    }
+
+    return false;
+  }
+);

+ 18 - 0
php-pimf/app/bootstrap.app.php

@@ -0,0 +1,18 @@
+<?php
+/*
+|--------------------------------------------------------------------------
+| PIMF bootstrap
+|--------------------------------------------------------------------------
+*/
+if(!defined('DS')) define('DS', DIRECTORY_SEPARATOR, true);
+if(!defined('BASE_PATH')) define('BASE_PATH', realpath(dirname(dirname(__FILE__))) . DS, true);
+
+$config = include_once BASE_PATH .'app/config.app.php';
+
+require_once BASE_PATH .'pimf-framework/autoload.core.php';
+require_once BASE_PATH .'app/autoload.app.php';
+require_once BASE_PATH .'pimf-framework/utils.php';
+
+use \Pimf\Application as App;
+
+App::bootstrap($config, $_SERVER);

+ 167 - 0
php-pimf/app/config.app.php

@@ -0,0 +1,167 @@
+<?php
+/*
+|--------------------------------------------------------------------------
+| PIMF Application Configuration
+|--------------------------------------------------------------------------
+|
+| The PIMF configuration is responsible for returning an array
+| of configuration options. By default, we use the variable $config provided 
+| with PIMF - however, you are free to use your own storage mechanism for 
+| configuration arrays.
+|
+*/
+return array(
+
+  /*
+  |------------------------------------------------------------------------
+  | The default environment mode for your application [testing|production]
+  |------------------------------------------------------------------------
+  */
+  'environment' => 'production',
+
+  /*
+  |------------------------------------------------------------------------
+  | The default character encoding used by your application.
+  |------------------------------------------------------------------------
+  */
+  'encoding' => 'UTF-8',
+  
+  /*
+  |------------------------------------------------------------------------
+  | The default timezone of your application.
+  | Supported timezones list: http://www.php.net/manual/en/timezones.php
+  |------------------------------------------------------------------------
+  */
+  'timezone' => 'UTC',
+
+  /*
+  |--------------------------------------------------------------------------
+  | Is it regular HTTP or secure HTTPS
+  |--------------------------------------------------------------------------
+  */
+  'ssl' => false,
+  
+  /*
+  |------------------------------------------------------------------------
+  | Application meta
+  |------------------------------------------------------------------------
+  */
+  'app' => array(
+    'name'               => 'Vanilla',
+    'key'                => 'some5secret5key5here', // application key
+    'default_controller' => 'hello', // the name of the fallback controller
+    'routeable'          => true, // get cleaner URLs or not
+    'url'                => 'http://localhost', // URL used to access your application without a trailing slash.
+    'index'              => '', // if you are using mod_rewrite to get cleaner URLs let it empty otherwise set index.php
+    'asset_url'          => '', // the base URL used for your application's asset files
+  ),
+
+  /*
+  |------------------------------------------------------------------------
+  | Production environment settings
+  |------------------------------------------------------------------------
+  */
+  'production' => array(
+    'db' => array(
+      'driver' => 'mysql',
+      'host' => '192.168.100.102',
+      'database' => 'hello_world',
+      'username' => 'benchmarkdbuser',
+      'password' => 'benchmarkdbpass',
+      'charset' => 'utf8',
+      'port' => '3306',
+      // 'unix_socket' => '',
+    ),
+  ),
+
+  /*
+  |------------------------------------------------------------------------
+  | Bootstrapping and dependencies to php-version and extensions
+  |------------------------------------------------------------------------
+  */
+  'bootstrap' => array(
+    'local_temp_directory' => '/tmp/'
+  ),
+
+  /*
+  |------------------------------------------------------------------------
+  | Settings for the error handling behavior
+  |------------------------------------------------------------------------
+  */
+  'error' => array(
+    'ignore_levels' => array(E_USER_DEPRECATED),
+    'debug_info' => false, // true = if developing - false = if production
+    'log' => true,
+  ),
+
+  /*
+  |--------------------------------------------------------------------------
+  | Session settings
+  |--------------------------------------------------------------------------
+  */
+  'session' => array(
+
+      // Session storage 'cookie', 'file', 'pdo', 'memcached', 'apc', 'redis', 'dba', 'wincache', 'memory'
+      'storage' => null,
+
+      // If using file storage - default is null
+      'storage_path' => 'app/Vanilla/_session/',
+
+      // If using the PDO (database) session storage
+      'database' => array(
+        //'driver' => 'sqlite',
+        //'database' => 'app/Vanilla/_session/session.db',
+      ),
+
+      // Garbage collection has a 2% chance of occurring for any given request to
+      // the application. Feel free to tune this to your requirements.
+      'garbage_collection' => array(2, 100),
+
+      // Session lifetime number of minutes
+      'lifetime' => 60,
+
+      // Session expiration on web browser close
+      'expire_on_close' => false,
+
+      // Session cookie name
+      'cookie' => 'pimf_session',
+
+      // Session cookie path
+      'path' => '/',
+
+      // Domain for which the session cookie is available.
+      'domain' => null,
+
+      // If the cookie should only be sent over HTTPS.
+      'secure' => false,
+  ),
+
+  /*
+  |--------------------------------------------------------------------------
+  | Cache settings
+  |--------------------------------------------------------------------------
+  */
+  'cache' => array(
+
+      // Cache storage 'pdo', 'file', 'memcached', 'apc', 'redis', 'dba', 'wincache', 'memory'
+      'storage' => null,
+
+      // If using file storage - default is null
+      'storage_path' => 'app/Vanilla/_cache/',
+
+      // If using the PDO (database) cache storage
+      'database' => array(
+        //'driver' => 'sqlite',
+        //'database' => 'app/Vanilla/_cache/cache.db',
+      ),
+
+      // If using Memcached and APC to prevent collisions with other applications on the server.
+      'key' => 'pimfmaster',
+
+      // Memcached servers - for more check out: http://memcached.org
+      'memcached' => array(
+        'servers' => array('host' => '127.0.0.1', 'port' => 11211, 'weight' => 100),
+      ),
+   ),
+
+);

+ 47 - 0
php-pimf/benchmark_config

@@ -0,0 +1,47 @@
+{
+  "framework": "pimf",
+  "tests": [{
+    "default": {
+      "setup_file": "setup",
+      "db_url": "/db",
+      "query_url": "/db?queries=",
+      "port": 8080,
+      "approach": "Realistic",
+      "classification": "Micro",
+      "database": "MySQL",
+      "framework": "pimf",
+      "language": "PHP",
+      "orm": "Raw",
+      "platform": "PHP-FPM",
+      "webserver": "nginx",
+      "os": "Linux",
+      "database_os": "Linux",
+      "display_name": "pimf",
+      "notes": "",
+      "versus": "php"
+    },
+    "raw": {
+      "setup_file": "setup_raw",
+      "json_url": "/json",
+      "db_url": "/db",
+      "query_url": "/queries?queries=",
+      "fortune_url": "/fortunes",
+      "update_url": "/updates?queries=",
+      "plaintext_url": "/plaintext",
+      "port": 8080,
+      "approach": "Realistic",
+      "classification": "Micro",
+      "database": "MySQL",
+      "framework": "pimf",
+      "language": "PHP",
+      "orm": "Raw",
+      "platform": "PHP-FPM",
+      "webserver": "nginx",
+      "os": "Linux",
+      "database_os": "Linux",
+      "display_name": "pimf",
+      "notes": "",
+      "versus": "php"
+    }
+  }]
+}

+ 5 - 0
php-pimf/composer.json

@@ -0,0 +1,5 @@
+{
+    "require": {
+        "gjerokrsteski/pimf-framework": "1.8.*"
+    }
+}

+ 133 - 0
php-pimf/deploy/nginx.conf

@@ -0,0 +1,133 @@
+#user  nobody;
+worker_processes  8;
+
+#error_log  logs/error.log;
+#error_log  logs/error.log  notice;
+#error_log  logs/error.log  info;
+error_log /dev/null crit;
+
+#pid        logs/nginx.pid;
+
+
+events {
+    worker_connections  1024;
+}
+
+
+http {
+    include       /usr/local/nginx/conf/mime.types;
+    default_type  application/octet-stream;
+
+    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
+    #                  '$status $body_bytes_sent "$http_referer" '
+    #                  '"$http_user_agent" "$http_x_forwarded_for"';
+
+    #access_log  logs/access.log  main;
+    access_log off;
+
+    sendfile        on;
+    #tcp_nopush     on;
+
+    #keepalive_timeout  0;
+    keepalive_timeout  65;
+
+    #gzip  on;
+
+    upstream fastcgi_backend {
+        server 127.0.0.1:9001;
+        keepalive 32;
+    }
+
+    server {
+        listen       8080;
+        server_name  localhost;
+
+        #charset koi8-r;
+
+        #access_log  logs/host.access.log  main;
+
+        #location / {
+        #    root   html;
+        #    index  index.html index.htm;
+        #}
+
+        #error_page  404              /404.html;
+
+        # redirect server error pages to the static page /50x.html
+        #
+        #error_page   500 502 503 504  /50x.html;
+        #location = /50x.html {
+        #    root   html;
+        #}
+
+        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
+        #
+        #location ~ \.php$ {
+        #    proxy_pass   http://127.0.0.1;
+        #}
+
+        root /home/ubuntu/FrameworkBenchmarks/php-pimf/;
+        index  index.php;
+
+        location / {
+            try_files $uri $uri/ /index.php?$uri&$args;
+        }
+
+        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
+        #
+        location ~ \.php$ {
+            try_files $uri =404;
+            fastcgi_pass   fastcgi_backend;
+            fastcgi_keep_conn on;
+            fastcgi_index  index.php;
+#            fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
+            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
+            include        /usr/local/nginx/conf/fastcgi_params;
+        }
+
+        # deny access to .htaccess files, if Apache's document root
+        # concurs with nginx's one
+        #
+        #location ~ /\.ht {
+        #    deny  all;
+        #}
+    }
+
+
+    # another virtual host using mix of IP-, name-, and port-based configuration
+    #
+    #server {
+    #    listen       8000;
+    #    listen       somename:8080;
+    #    server_name  somename  alias  another.alias;
+
+    #    location / {
+    #        root   html;
+    #        index  index.html index.htm;
+    #    }
+    #}
+
+
+    # HTTPS server
+    #
+    #server {
+    #    listen       443;
+    #    server_name  localhost;
+
+    #    ssl                  on;
+    #    ssl_certificate      cert.pem;
+    #    ssl_certificate_key  cert.key;
+
+    #    ssl_session_timeout  5m;
+
+    #    ssl_protocols  SSLv2 SSLv3 TLSv1;
+    #    ssl_ciphers  HIGH:!aNULL:!MD5;
+    #    ssl_prefer_server_ciphers   on;
+
+    #    location / {
+    #        root   html;
+    #        index  index.html index.htm;
+    #    }
+    #}
+
+}

+ 127 - 0
php-pimf/deploy/nginx_raw.conf

@@ -0,0 +1,127 @@
+#user  nobody;
+worker_processes  8;
+
+#error_log  logs/error.log;
+#error_log  logs/error.log  notice;
+#error_log  logs/error.log  info;
+error_log /dev/null crit;
+
+#pid        logs/nginx.pid;
+
+
+events {
+    worker_connections  1024;
+}
+
+
+http {
+    include       /usr/local/nginx/conf/mime.types;
+    default_type  application/octet-stream;
+
+    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
+    #                  '$status $body_bytes_sent "$http_referer" '
+    #                  '"$http_user_agent" "$http_x_forwarded_for"';
+
+    #access_log  logs/access.log  main;
+    access_log off;
+
+    sendfile        on;
+    #tcp_nopush     on;
+
+    #keepalive_timeout  0;
+    keepalive_timeout  65;
+
+    #gzip  on;
+
+    server {
+        listen       8080;
+        server_name  localhost;
+
+        #charset koi8-r;
+
+        #access_log  logs/host.access.log  main;
+
+        #location / {
+        #    root   html;
+        #    index  index.html index.htm;
+        #}
+
+        #error_page  404              /404.html;
+
+        # redirect server error pages to the static page /50x.html
+        #
+        #error_page   500 502 503 504  /50x.html;
+        #location = /50x.html {
+        #    root   html;
+        #}
+
+        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
+        #
+        #location ~ \.php$ {
+        #    proxy_pass   http://127.0.0.1;
+        #}
+
+        root /home/mrobertson/FrameworkBenchmarks/php-pimf/;
+        index  index_raw.php;
+
+        location / {
+            try_files $uri $uri/ /index_raw.php?$uri&$args;
+        }
+
+        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
+        #
+        location ~ \.php$ {
+            try_files $uri =404;
+            fastcgi_pass   127.0.0.1:9001;
+            fastcgi_index  index_raw.php;
+#            fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
+            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
+            include        /usr/local/nginx/conf/fastcgi_params;
+        }
+
+        # deny access to .htaccess files, if Apache's document root
+        # concurs with nginx's one
+        #
+        #location ~ /\.ht {
+        #    deny  all;
+        #}
+    }
+
+
+    # another virtual host using mix of IP-, name-, and port-based configuration
+    #
+    #server {
+    #    listen       8000;
+    #    listen       somename:8080;
+    #    server_name  somename  alias  another.alias;
+
+    #    location / {
+    #        root   html;
+    #        index  index.html index.htm;
+    #    }
+    #}
+
+
+    # HTTPS server
+    #
+    #server {
+    #    listen       443;
+    #    server_name  localhost;
+
+    #    ssl                  on;
+    #    ssl_certificate      cert.pem;
+    #    ssl_certificate_key  cert.key;
+
+    #    ssl_session_timeout  5m;
+
+    #    ssl_protocols  SSLv2 SSLv3 TLSv1;
+    #    ssl_ciphers  HIGH:!aNULL:!MD5;
+    #    ssl_prefer_server_ciphers   on;
+
+    #    location / {
+    #        root   html;
+    #        index  index.html index.htm;
+    #    }
+    #}
+
+}

+ 9 - 0
php-pimf/deploy/php-pimf

@@ -0,0 +1,9 @@
+<VirtualHost *:8080>
+  Alias /php-pimf/ "/home/mrobertson/FrameworkBenchmarks/php-pimf/"
+  <Directory /home/mrobertson/FrameworkBenchmarks/php-pimf/>
+          Options Indexes FollowSymLinks MultiViews
+          #AllowOverride None
+          Order allow,deny
+          allow from all
+  </Directory>
+</VirtualHost>

+ 0 - 0
php-pimf/favicon.ico


+ 13 - 0
php-pimf/index.php

@@ -0,0 +1,13 @@
+<?php
+/*
+|--------------------------------------------------------------------------
+| PIMF Application gateway/runner
+|--------------------------------------------------------------------------
+*/
+include_once 'app/bootstrap.app.php';
+
+use \Pimf\Application as App;
+
+App::run($_GET, $_POST, $_COOKIE);
+
+App::finish();

+ 25 - 0
php-pimf/license.txt

@@ -0,0 +1,25 @@
+New BSD License
+
+Copyright (c) 2013, Gjero Krsteski (http://krsteski.de)
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions and the following
+disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
+disclaimer in the documentation and/or other materials provided with the distribution.
+
+* Neither the name of Gjero Krsteski nor the names of its contributors may be used to endorse or promote products
+derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

+ 4 - 0
php-pimf/pimf

@@ -0,0 +1,4 @@
+#!/usr/bin/php
+<?php
+require 'index.php';
+?>

+ 34 - 0
php-pimf/setup.py

@@ -0,0 +1,34 @@
+import subprocess
+import sys
+import setup_util
+from os.path import expanduser
+
+home = expanduser("~")
+
+def start(args):
+  setup_util.replace_text("php-pimf/app/config.app.php", "192.168.100.102", "" + args.database_host + "")
+  setup_util.replace_text("php-pimf/deploy/php-pimf", "\".*\/FrameworkBenchmarks", "\"" + home + "/FrameworkBenchmarks")
+  setup_util.replace_text("php-pimf/deploy/php-pimf", "Directory .*\/FrameworkBenchmarks", "Directory " + home + "/FrameworkBenchmarks")
+  setup_util.replace_text("php-pimf/deploy/nginx.conf", "root .*\/FrameworkBenchmarks", "root " + home + "/FrameworkBenchmarks")
+
+  try:
+    #subprocess.check_call("sudo cp cake/deploy/cake /etc/apache2/sites-available/", shell=True)
+    #subprocess.check_call("sudo a2ensite cake", shell=True)
+    #subprocess.check_call("sudo chown -R www-data:www-data cake", shell=True)
+    #subprocess.check_call("sudo /etc/init.d/apache2 start", shell=True)
+    subprocess.check_call("composer.phar install --optimize-autoloader", shell=True, cwd="php-pimf")        
+    subprocess.check_call("sudo php-fpm --fpm-config config/php-fpm.conf -g " + home + "/FrameworkBenchmarks/php-pimf/deploy/php-fpm.pid", shell=True)
+    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c " + home + "/FrameworkBenchmarks/php-pimf/deploy/nginx.conf", shell=True)
+    return 0
+  except subprocess.CalledProcessError:
+    return 1
+def stop():
+  try:
+    subprocess.call("sudo /usr/local/nginx/sbin/nginx -s stop", shell=True)
+    subprocess.call("sudo kill -QUIT $( cat php-pimf/deploy/php-fpm.pid )", shell=True)
+    #subprocess.check_call("sudo a2dissite cake", shell=True)
+    #subprocess.check_call("sudo /etc/init.d/apache2 stop", shell=True)
+    #subprocess.check_call("sudo chown -R $USER:$USER cake", shell=True)    
+    return 0
+  except subprocess.CalledProcessError:
+    return 1

+ 28 - 0
php-pimf/setup_raw.py

@@ -0,0 +1,28 @@
+import subprocess
+import sys
+import setup_util
+from os.path import expanduser
+
+home = expanduser("~")
+
+def start(args):
+  setup_util.replace_text("php-pimf/app/config.app.php", "192.168.100.102", "" + args.database_host + "")
+  setup_util.replace_text("php-pimf/deploy/php-pimf", "\".*\/FrameworkBenchmarks", "\"" + home + "/FrameworkBenchmarks")
+  setup_util.replace_text("php-pimf/deploy/php-pimf", "Directory .*\/FrameworkBenchmarks", "Directory " + home + "/FrameworkBenchmarks")
+  setup_util.replace_text("php-pimf/deploy/nginx_raw.conf", "root .*\/FrameworkBenchmarks", "root " + home + "/FrameworkBenchmarks")
+
+  try:
+    subprocess.check_call("composer.phar install --optimize-autoloader", shell=True, cwd="php-pimf")
+    subprocess.check_call("sudo php-fpm --fpm-config config/php-fpm.conf -g " + home + "/FrameworkBenchmarks/php-pimf/deploy/php-fpm.pid", shell=True)
+    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c " + home + "/FrameworkBenchmarks/php-pimf/deploy/nginx_raw.conf", shell=True)
+    return 0
+  except subprocess.CalledProcessError:
+    return 1
+
+def stop():
+  try:
+    subprocess.call("sudo /usr/local/nginx/sbin/nginx -s stop", shell=True)
+    subprocess.call("sudo kill -QUIT $( cat php-pimf/deploy/php-fpm.pid )", shell=True)
+    return 0
+  except subprocess.CalledProcessError:
+    return 1

+ 96 - 0
php-pimf/source_code

@@ -0,0 +1,96 @@
+./php-pimf/index.php
+./php-pimf/app/
+./php-pimf/app/Vanilla/routes.php
+./php-pimf/app/autoload.app.php
+./php-pimf/app/bootstrap.app.php
+./php-pimf/app/config.app.php
+./php-pimf/app/Vanilla/Controller/Hello.php
+./php-pimf/pimf-framework/
+./php-pimf/pimf-framework/core/Pimf/Application.php
+./php-pimf/pimf-framework/core/Pimf/Cache.php
+./php-pimf/pimf-framework/core/Pimf/Cache/Storages/Apc.php
+./php-pimf/pimf-framework/core/Pimf/Cache/Storages/Dba.php
+./php-pimf/pimf-framework/core/Pimf/Cache/Storages/File.php
+./php-pimf/pimf-framework/core/Pimf/Cache/Storages/Memcached.php
+./php-pimf/pimf-framework/core/Pimf/Cache/Storages/Memory.php
+./php-pimf/pimf-framework/core/Pimf/Cache/Storages/Pdo.php
+./php-pimf/pimf-framework/core/Pimf/Cache/Storages/Redis.php
+./php-pimf/pimf-framework/core/Pimf/Cache/Storages/Storage.php
+./php-pimf/pimf-framework/core/Pimf/Cache/Storages/Wincache.php
+./php-pimf/pimf-framework/core/Pimf/Cli.php
+./php-pimf/pimf-framework/core/Pimf/Cli/Color.php
+./php-pimf/pimf-framework/core/Pimf/Cli/Std.php
+./php-pimf/pimf-framework/core/Pimf/Contracts/Arrayable.php
+./php-pimf/pimf-framework/core/Pimf/Contracts/Cleanable.php
+./php-pimf/pimf-framework/core/Pimf/Contracts/Jsonable.php
+./php-pimf/pimf-framework/core/Pimf/Contracts/MessageProvider.php
+./php-pimf/pimf-framework/core/Pimf/Contracts/Renderable.php
+./php-pimf/pimf-framework/core/Pimf/Contracts/Reunitable.php
+./php-pimf/pimf-framework/core/Pimf/Controller/Base.php
+./php-pimf/pimf-framework/core/Pimf/Controller/Core.php
+./php-pimf/pimf-framework/core/Pimf/Controller/Exception.php
+./php-pimf/pimf-framework/core/Pimf/Cookie.php
+./php-pimf/pimf-framework/core/Pimf/Database.php
+./php-pimf/pimf-framework/core/Pimf/DataMapper/Base.php
+./php-pimf/pimf-framework/core/Pimf/EntityManager.php
+./php-pimf/pimf-framework/core/Pimf/Environment.php
+./php-pimf/pimf-framework/core/Pimf/Error.php
+./php-pimf/pimf-framework/core/Pimf/Event.php
+./php-pimf/pimf-framework/core/Pimf/Logger.php
+./php-pimf/pimf-framework/core/Pimf/Memcached.php
+./php-pimf/pimf-framework/core/Pimf/Model/AsArray.php
+./php-pimf/pimf-framework/core/Pimf/Param.php
+./php-pimf/pimf-framework/core/Pimf/Pdo/Connector.php
+./php-pimf/pimf-framework/core/Pimf/Pdo/Factory.php
+./php-pimf/pimf-framework/core/Pimf/Pdo/Mysql.php
+./php-pimf/pimf-framework/core/Pimf/Pdo/Postgre.php
+./php-pimf/pimf-framework/core/Pimf/Pdo/Sqlite.php
+./php-pimf/pimf-framework/core/Pimf/Pdo/Sqlserver.php
+./php-pimf/pimf-framework/core/Pimf/Redis.php
+./php-pimf/pimf-framework/core/Pimf/Registry.php
+./php-pimf/pimf-framework/core/Pimf/Request.php
+./php-pimf/pimf-framework/core/Pimf/Resolver.php
+./php-pimf/pimf-framework/core/Pimf/Resolver/Exception.php
+./php-pimf/pimf-framework/core/Pimf/Response.php
+./php-pimf/pimf-framework/core/Pimf/Route.php
+./php-pimf/pimf-framework/core/Pimf/Route/Target.php
+./php-pimf/pimf-framework/core/Pimf/Router.php
+./php-pimf/pimf-framework/core/Pimf/Sapi.php
+./php-pimf/pimf-framework/core/Pimf/Session.php
+./php-pimf/pimf-framework/core/Pimf/Session/Payload.php
+./php-pimf/pimf-framework/core/Pimf/Session/Storages/Apc.php
+./php-pimf/pimf-framework/core/Pimf/Session/Storages/Cookie.php
+./php-pimf/pimf-framework/core/Pimf/Session/Storages/Dba.php
+./php-pimf/pimf-framework/core/Pimf/Session/Storages/File.php
+./php-pimf/pimf-framework/core/Pimf/Session/Storages/Memcached.php
+./php-pimf/pimf-framework/core/Pimf/Session/Storages/Memory.php
+./php-pimf/pimf-framework/core/Pimf/Session/Storages/Pdo.php
+./php-pimf/pimf-framework/core/Pimf/Session/Storages/Redis.php
+./php-pimf/pimf-framework/core/Pimf/Session/Storages/Storage.php
+./php-pimf/pimf-framework/core/Pimf/Uri.php
+./php-pimf/pimf-framework/core/Pimf/Url.php
+./php-pimf/pimf-framework/core/Pimf/Util/Dom.php
+./php-pimf/pimf-framework/core/Pimf/Util/File.php
+./php-pimf/pimf-framework/core/Pimf/Util/Header.php
+./php-pimf/pimf-framework/core/Pimf/Util/Header/ContentType.php
+./php-pimf/pimf-framework/core/Pimf/Util/Header/ResponseStatus.php
+./php-pimf/pimf-framework/core/Pimf/Util/Identifier.php
+./php-pimf/pimf-framework/core/Pimf/Util/IdentityMap.php
+./php-pimf/pimf-framework/core/Pimf/Util/Json.php
+./php-pimf/pimf-framework/core/Pimf/Util/Ldap.php
+./php-pimf/pimf-framework/core/Pimf/Util/Ldap/User.php
+./php-pimf/pimf-framework/core/Pimf/Util/LineByLine.php
+./php-pimf/pimf-framework/core/Pimf/Util/Message.php
+./php-pimf/pimf-framework/core/Pimf/Util/Serializer.php
+./php-pimf/pimf-framework/core/Pimf/Util/String.php
+./php-pimf/pimf-framework/core/Pimf/Util/String/Clean.php
+./php-pimf/pimf-framework/core/Pimf/Util/Uploaded.php
+./php-pimf/pimf-framework/core/Pimf/Util/Uploaded/Factory.php
+./php-pimf/pimf-framework/core/Pimf/Util/Uuid.php
+./php-pimf/pimf-framework/core/Pimf/Util/Validator.php
+./php-pimf/pimf-framework/core/Pimf/Util/Validator/Factory.php
+./php-pimf/pimf-framework/core/Pimf/Util/Value.php
+./php-pimf/pimf-framework/core/Pimf/Util/Xml.php
+./php-pimf/pimf-framework/core/Pimf/View.php
+./php-pimf/pimf-framework/core/Pimf/View/Haanga.php
+./php-pimf/pimf-framework/core/Pimf/View/Twig.php