diff --git a/benchmark-no-apache.sh b/benchmark-no-apache.sh new file mode 100644 index 000000000..3ba5c5d05 --- /dev/null +++ b/benchmark-no-apache.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +#base="http://127.0.0.1/php-framework-benchmark" +base="http://localhost:8888/php-framework-benchmark" + +cd `dirname $0` + +php -S localhost:8888 -t .. > /dev/null 2>&1 & +PHP_PID=$! +sleep 2; + +if [ $# -eq 0 ]; then + # include framework list + . ./list.sh + export targets="$list" +else + export targets="${@%/}" +fi + +cd benchmarks + +sh hello_world.sh "$base" + +php ../bin/show_results_table.php +kill $PHP_PID diff --git a/benchmarks/_functions.sh b/benchmarks/_functions.sh index 32fec509e..030f945a1 100644 --- a/benchmarks/_functions.sh +++ b/benchmarks/_functions.sh @@ -13,7 +13,8 @@ benchmark () # get time count=10 total=0 - for ((i=0; i < $count; i++)); do + #for ((i=0; i < $count; i++)); do + for i in $(seq 0 $count); do curl "$url" > "$output" t=`tail -1 "$output" | cut -f 2 -d ':'` total=`php ./benchmarks/sum_ms.php $t $total` diff --git a/libs/parse_results.php b/libs/parse_results.php index ccf5d4183..c36a0bb98 100644 --- a/libs/parse_results.php +++ b/libs/parse_results.php @@ -18,10 +18,10 @@ function parse_results($file) $time = (float) trim($column[3])*1000; $file = (int) trim($column[4]); - $min_rps = min($min_rps, $rps); - $min_memory = min($min_memory, $memory); - $min_time = min($min_time, $time); - $min_file = min($min_file, $file); + $min_rps = min($min_rps, $rps ?: INF); + $min_memory = min($min_memory, $memory ?: INF); + $min_time = min($min_time, $time ?: INF); + $min_file = min($min_file, $file ?: INF); $results[$fw] = [ 'rps' => $rps, diff --git a/list.sh b/list.sh index f2bf65c73..639691a78 100755 --- a/list.sh +++ b/list.sh @@ -40,6 +40,9 @@ staticphp-0.9 #symfony-2.6 #symfony-2.7 symfony-3.0 +symfony-3.4 +symfony-3.4-micro +symfony-3.4-empty tipsy-0.10 #typo3f-2.3 # does not work #typo3f-3.0 # Catchable Fatal Error: Argument 1 passed to TYPO3\Flow\Object\ObjectManager::setObjects() must be of the type array, null given diff --git a/nofuss-1.2/.gitignore b/nofuss-1.2/.gitignore new file mode 100644 index 000000000..f5b481dc8 --- /dev/null +++ b/nofuss-1.2/.gitignore @@ -0,0 +1,4 @@ +/cache/ +!/cache/.gitkeep +!/cache/smarty/.gitignore +!/cache/templates_c/.gitignore \ No newline at end of file diff --git a/nofuss-1.2/cache/.gitkeep b/nofuss-1.2/cache/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/nofuss-1.2/cache/nf.all.php b/nofuss-1.2/cache/nf.all.php deleted file mode 100644 index 70d879b81..000000000 --- a/nofuss-1.2/cache/nf.all.php +++ /dev/null @@ -1,6565 +0,0 @@ -session)) { - // optional parameters sent to the constructor - if (isset($config->session->params)) { - $sessionParams = $config->session->params; - } - if (is_object($config->session->handler)) { - $sessionHandler = self::factory($config->session->handler->namespace, $config->session->handler->class, $sessionParams, $config->session->lifetime); - } else { - $sessionHandler = self::factory('Nf\Session', $config->session->handler, $sessionParams, $config->session->lifetime); - } - - session_name($config->session->cookie->name); - session_set_cookie_params(0, $config->session->cookie->path, $config->session->cookie->domain, false, true); - - session_set_save_handler(array( - &$sessionHandler, - 'open' - ), array( - &$sessionHandler, - 'close' - ), array( - &$sessionHandler, - 'read' - ), array( - &$sessionHandler, - 'write' - ), array( - &$sessionHandler, - 'destroy' - ), array( - &$sessionHandler, - 'gc' - )); - register_shutdown_function('session_write_close'); - session_start(); - // session_regenerate_id(true); - Registry::set('session', $sessionHandler); - return $sessionHandler; - } else { - return false; - } - - } - - public static function getData() - { - return $_SESSION; - } - - public function __get($key) - { - return self::get($key); - } - - public function __set($key, $value) - { - return self::set($key, $value); - } - - public static function get($key) - { - if (isset($_SESSION[$key])) { - return $_SESSION[$key]; - } else { - return null; - } - } - - public static function set($key, $value) - { - $_SESSION[$key] = $value; - } - - public static function delete($key) - { - unset($_SESSION[$key]); - } -} - - - -namespace Nf; - -abstract class Singleton -{ - - protected static $_instance=null; - - protected function __construct() - { - } - - public static function getInstance() - { - if (static::$_instance===null) { - $className = get_called_class(); - static::$_instance = new $className; - } - - return static::$_instance; - } - - public function __clone() - { - throw new Exception('Cloning not allowed on a singleton object', E_USER_ERROR); - } -} - - -namespace Nf; - -class Make -{ - - /** - * - * @param string $action - * Executes a make action, like "compress" for putting every file into a single .php file or "map" all the classes in a classmap - * You can use your method with make if you call something like: - * php index.php -m "\App\Mymake\Compressor::compress?type=js", type=js will be accessible with a - * $front = \Nf\Front::getInstance(); - * $params = $front->getRequest()->getParams(); - * - */ - - // merge all the framework files to a single php file, merge all the routes to /cache/allroutes.php - public static function compress($action = '') - { - // merge framework files - $destFile = Registry::get('applicationPath') . '/cache/nf.all.php'; - if (is_file($destFile)) { - unlink($destFile); - } - // get the actual folder of Nf in the app's settings - $includedFiles = get_included_files(); - $folder = null; - - foreach ($includedFiles as $includedFile) { - if (preg_match('%Nf\/Autoloader\.php$%', $includedFile, $regs)) { - $folder = str_replace('/Autoloader.php', '', $includedFile); - $allFiles = self::getAllFiles($folder); - // sort by depth for include - uasort($allFiles, array( - 'self', - 'orderFilesByDepth' - )); - $bigInclude = 'setRootRoutes(); - $router->setRoutesFromFiles(); - $router->addAllRoutes(); - $allRoutes = $router->getAllRoutes(); - $bigInclude = ' substr_count($file2, '/')); - return $t ? 1 : - 1; - } -} - - -namespace Nf; - -class Db -{ - - const FETCH_ASSOC = 2; - - const FETCH_NUM = 3; - - const FETCH_OBJ = 5; - - const FETCH_COLUMN = 7; - - private static $_connections = array(); - - public static function factory($config) - { - if (! is_array($config)) { - // convert to an array - $conf = array(); - $conf['adapter'] = $config->adapter; - $conf['params'] = (array) $config->params; - $conf['profiler'] = (array) $config->profiler; - } else { - $conf = $config; - } - $adapterName = get_class() . '\\Adapter\\' . $conf['adapter']; - $dbAdapter = new $adapterName($conf['params']); - $dbAdapter->setProfilerConfig($conf['profiler']); - return $dbAdapter; - } - - public static function getConnection($configName, $alternateHostname = null, $alternateDatabase = null, $storeInInstance = true) - { - $config = \Nf\Registry::get('config'); - - if(!isset($config->db->$configName)) { - throw new \Exception('The adapter "' . $configName . '" is not defined in the config file'); - } - - $defaultHostname = $config->db->$configName->params->hostname; - $defaultDatabase = $config->db->$configName->params->database; - $hostname = ($alternateHostname !== null) ? $alternateHostname : $defaultHostname; - $database = ($alternateDatabase !== null) ? $alternateDatabase : $defaultDatabase; - - // if the connection has already been created and if we store the connection in memory for future use - if (isset(self::$_connections[$configName . '-' . $hostname . '-' . $database]) && $storeInInstance) { - return self::$_connections[$configName . '-' . $hostname . '-' . $database]; - } else { - // optional profiler config - $profilerConfig = isset($config->db->$configName->profiler) ? (array)$config->db->$configName->profiler : null; - if ($profilerConfig != null) { - $profilerConfig['name'] = $configName; - } - - // or else we create a new connection - $dbConfig = array( - 'adapter' => $config->db->$configName->adapter, - 'params' => array( - 'hostname' => $hostname, - 'username' => $config->db->$configName->params->username, - 'password' => $config->db->$configName->params->password, - 'database' => $database, - 'charset' => $config->db->$configName->params->charset - ), - 'profiler' => $profilerConfig - ); - - // connection with the factory method - $dbConnection = self::factory($dbConfig); - if ($storeInInstance) { - self::$_connections[$configName . '-' . $hostname . '-' . $database] = $dbConnection; - } - return $dbConnection; - } - } -} - - - -namespace Nf; - -use \IntlDateFormatter; -use \NumberFormatter; - -class Localization extends Singleton -{ - - protected static $_instance; - - protected $_currentLocale='fr_FR'; - - const NONE=IntlDateFormatter::NONE; - const SHORT=IntlDateFormatter::SHORT; - const MEDIUM=IntlDateFormatter::MEDIUM; - const LONG=IntlDateFormatter::LONG; - const FULL=IntlDateFormatter::FULL; - - public static function normalizeLocale($str) - { - $str=str_replace('-', '_', $str); - $arr=explode('_', $str); - $out=strtolower($arr[0]) . '_' . strtoupper($arr[1]); - return $out; - } - - public static function setLocale($locale) - { - $instance=self::$_instance; - $instance->_currentLocale=$locale; - } - - public static function getLocale() - { - $instance=self::$_instance; - return $instance->_currentLocale; - } - - public static function formatDate($timestamp, $formatDate = self::SHORT, $formatTime = self::SHORT) - { - $instance=self::$_instance; - $fmt=new IntlDateFormatter($instance->_currentLocale, $formatDate, $formatTime); - return $fmt->format($timestamp); - } - - // syntax can be found on : http://userguide.icu-project.org/formatparse/datetime - public static function formatOther($timestamp, $format = 'eeee') - { - $instance=self::$_instance; - $fmt=new IntlDateFormatter($instance->_currentLocale, 0, 0); - $fmt->setPattern($format); - return $fmt->format($timestamp); - } - - public static function formatDay($timestamp, $fullName = true) - { - return self::formatOther($timestamp, ($fullName?'EEEE':'EEE')); - } - - public static function formatMonth($timestamp, $fullName = true) - { - return self::formatOther($timestamp, ($fullName?'LLLL':'LLL')); - } - - public static function formatCurrency($amount, $currency) - { - $instance=self::$_instance; - $fmt = new NumberFormatter($instance->_currentLocale, NumberFormatter::CURRENCY); - return $fmt->formatCurrency($amount, $currency); - } - - public static function formatNumber($value) - { - $instance=self::$_instance; - $fmt = new NumberFormatter($instance->_currentLocale, NumberFormatter::DECIMAL); - return $fmt->format($value); - } - - public static function dateToTimestamp($date, $formatDate = self::SHORT, $formatTime = self::SHORT, $acceptISOFormat = false) - { - if (self::isTimestamp($date)) { - return $date; - } elseif ($acceptISOFormat && self::isISOFormat($date)) { - $dt=new \DateTime($date); - return $dt->getTimestamp(); - } else { - $instance=self::$_instance; - $fmt=new IntlDateFormatter($instance->_currentLocale, $formatDate, $formatTime); - $timestamp=$fmt->parse($date); - if ($timestamp) { - return $timestamp; - } else { - throw new \Exception('input date is in another format and is not recognized:' . $date); - } - } - } - - public static function isISOFormat($date) - { - if (preg_match('/\A(?:^([1-3][0-9]{3,3})-(0?[1-9]|1[0-2])-(0?[1-9]|[1-2][1-9]|3[0-1])\s([0-1][0-9]|2[0-4]):([0-5][0-9]):([0-5][0-9])$)\Z/im', $date)) { - return true; - } elseif (preg_match('/\A(?:^([1-3][0-9]{3,3})-(0?[1-9]|1[0-2])-(0?[1-9]|[1-2][1-9]|3[0-1])$)\Z/im', $date)) { - return true; - } else { - return false; - } - } - - public static function isTimestamp($timestamp) - { - return ((string) (int) $timestamp === (string) $timestamp) - && ($timestamp <= PHP_INT_MAX) - && ($timestamp >= ~PHP_INT_MAX); - } -} - - -namespace Nf; - -use Nf\Registry; -use Nf\Front; - -class Router extends Singleton -{ - - // pour le routeur - private $routingPreferences = array(); - - private $routesDirectories = array(); - - private $rootRoutesDirectories = array(); - - private $allRoutesByVersionAndLocale = array(); - - private $activeRoute = array(); - - private $allVersionsUrls = array(); - - const rootRouteFilename = '_root.php'; - - const defaultRequestType = 'default'; - - const defaultRouteName = 'default'; - - // routes - public function addAllRoutes() - { - - if (Registry::get('environment')!='dev' && file_exists(Registry::get('applicationPath') . '/cache/routes.all.php')) { - $this->allRoutesByVersionAndLocale = require(Registry::get('applicationPath') . '/cache/routes.all.php'); - } else { - $routesDirectory = realpath(Registry::get('applicationPath') . '/routes'); - $directory = new \RecursiveDirectoryIterator($routesDirectory); - $files = new \RecursiveIteratorIterator($directory); - $allRouteFiles = array(); - foreach ($files as $file) { - $pathname = ltrim(str_replace($routesDirectory, '', $file->getPathname()), '/'); - // if it's not a folder or anything other than a .php - if (substr($pathname, - 1, 1) != '.' && substr($pathname, -4)=='.php') { - $allRouteFiles[] = $pathname; - } - } - // sort allRouteFiles by their depth to allow inheriting a route from all versions and or locales - usort($allRouteFiles, function ($a, $b) { - return substr_count($a, '/') > substr_count($b, '/'); - }); - foreach ($allRouteFiles as $file) { - $pathname = ltrim(str_replace($routesDirectory, '', $file), '/'); - - $arrPath = explode('/', $pathname); - - // routes are sorted by version and locale - if (count($arrPath) == 3) { - $version = $arrPath[0]; - $locale = $arrPath[1]; - } elseif (count($arrPath) == 2) { - $version = $arrPath[0]; - $locale = '*'; - } elseif (count($arrPath) == 1) { - $version = '*'; - $locale = '*'; - } - // add the route to allRoutes, sorted by version and locale - // all your routes are belong to us - if (! isset($this->allRoutesByVersionAndLocale[$version])) { - $this->allRoutesByVersionAndLocale[$version] = array(); - } - if (! isset($this->allRoutesByVersionAndLocale[$version][$locale])) { - $this->allRoutesByVersionAndLocale[$version][$locale] = array(); - } - if (basename($file) != self::rootRouteFilename) { - $subPath = str_replace('.php', '', basename($file)); - } else { - $subPath = ''; - } - $newRoutes = require $routesDirectory . '/' . $pathname; - // the file doesn't contain an array, or contains nothing => we ignore it - if (is_array($newRoutes)) { - foreach ($newRoutes as &$newRoute) { - if (isset($newRoute['type']) && $newRoute['type']=='inherit') { - // go up one level until we find the route to inherit from - if (isset($this->allRoutesByVersionAndLocale[$version]['*'][$newRoute['from']])) { - $routeToAdd = $this->allRoutesByVersionAndLocale[$version]['*'][$newRoute['from']]; - $routeToAdd['regexp'] = $routeToAdd['inheritableRegexp']; - $routeToAdd['regexp'] = ltrim($routeToAdd['regexp'], '/'); - $routeToAdd['regexp'] = rtrim(ltrim($subPath . '/' . $routeToAdd['regexp'], '/'), '/'); - } elseif (isset($this->allRoutesByVersionAndLocale['*']['*'][$newRoute['from']])) { - $routeToAdd = $this->allRoutesByVersionAndLocale['*']['*'][$newRoute['from']]; - $routeToAdd['regexp'] = $routeToAdd['inheritableRegexp']; - $routeToAdd['regexp'] = ltrim($routeToAdd['regexp'], '/'); - $routeToAdd['regexp'] = rtrim(ltrim($subPath . '/' . $routeToAdd['regexp'], '/'), '/'); - } - $this->allRoutesByVersionAndLocale[$version][$locale][$routeToAdd['name']] = $routeToAdd; - } else { - if (isset($newRoute['regexp'])) { - $newRoute['regexp'] = ltrim($newRoute['regexp'], '/'); - $newRoute['inheritableRegexp'] = $newRoute['regexp']; - $newRoute['regexp'] = rtrim(ltrim($subPath . '/' . $newRoute['regexp'], '/'), '/'); - } - if (isset($newRoute['name'])) { - $this->allRoutesByVersionAndLocale[$version][$locale][$newRoute['name']] = $newRoute; - } else { - $this->allRoutesByVersionAndLocale[$version][$locale][] = $newRoute; - } - } - } - } - } - } - } - - public function setRoutesFromFiles() - { - $this->routingPreferences[] = 'files'; - } - - public function setStructuredRoutes() - { - $this->routingPreferences[] = 'structured'; - } - - public function setRootRoutes() - { - $this->routingPreferences[] = 'root'; - } - - public function findRoute($version, $locale) - { - $foundController = null; - $config = Registry::get('config'); - $front = Front::getInstance(); - $originalUri = $front->getRequest()->getUri(); - - // remove everything after a '?' which is not used in the routing system - $uri = preg_replace('/\?.*$/', '', $originalUri); - - // strip the trailing slash, also unused - $uri = rtrim((string) $uri, '/'); - - foreach ($this->routingPreferences as $routingPref) { - if ($routingPref == 'files') { - $foundController = $this->findRouteFromFiles($uri, $version, $locale); - // search by version only - if (!$foundController) { - $foundController = $this->findRouteFromFiles($uri, $version, '*'); - } - // search without version nor locale - if (!$foundController) { - $foundController = $this->findRouteFromFiles($uri, '*', '*'); - } - } - - if (! $foundController && $routingPref == 'structured') { - // l'url doit être de la forme /m/c/a/, ou /m/c/ ou /m/ - if (preg_match('#^(\w+)/?(\w*)/?(\w*)#', $uri, $uriSegments)) { - $uriSegments[2] = ! empty($uriSegments[2]) ? $uriSegments[2] : 'index'; - $uriSegments[3] = ! empty($uriSegments[3]) ? $uriSegments[3] : 'index'; - - // on regarde si on a un fichier et une action pour le même chemin dans les répertoires des modules - if ($foundController = $front->checkModuleControllerAction($uriSegments[1], $uriSegments[2], $uriSegments[3])) { - $this->activeRoute = array( - 'type' => self::defaultRequestType, - 'name' => self::defaultRouteName, - 'components' => array() - ); - - // les éventuels paramètres sont en /variable/value - $paramsFromUri = ltrim(preg_replace('#^(\w+)/(\w+)/(\w+)#', '', $uri), '/'); - - // si on envoie des variables avec des / - if ($paramsFromUri != '') { - if (substr_count($paramsFromUri, '/') % 2 == 1) { - preg_match_all('/([\w_]+)\/([^\/]*)/', $paramsFromUri, $arrParams, PREG_SET_ORDER); - for ($matchi = 0; $matchi < count($arrParams); $matchi ++) { - $front->getRequest()->setParam($arrParams[$matchi][1], $arrParams[$matchi][2]); - } - } - - // si on envoie des variables avec des var1=val1 - if (substr_count($paramsFromUri, '=') >= 1) { - preg_match_all('/([\w_]+)=([^\/&]*)/', $paramsFromUri, $arrParams, PREG_SET_ORDER); - for ($matchi = 0; $matchi < count($arrParams); $matchi ++) { - $front->getRequest()->setParam($arrParams[$matchi][1], $arrParams[$matchi][2]); - } - } - } - } - } - } - } - - // si c'est la route par défaut - if (! $foundController) { - if (empty($uri)) { - if ($foundController = $front->checkModuleControllerAction($config->front->default->module, $config->front->default->controller, $config->front->default->action)) { - if (isset($route[2]) && isset($result[1])) { - $front->associateParams($route[2], $result[1]); - } - } - } - } - - // reads which middlewares are required and adds them - if ($foundController) { - if (isset($this->activeRoute['middlewares'])) { - $this->activeRoute['middlewaresPre'] = array(); - $this->activeRoute['middlewaresPost'] = array(); - foreach ($this->activeRoute['middlewares'] as $middlewareClass) { - if (! class_exists($middlewareClass)) { - throw new \Exception('The middleware ' . $middlewareClass . ' cannot be found. Matched route: ' . print_r($this->activeRoute, true)); - } - if (isset(class_uses($middlewareClass)['Nf\Middleware\Pre'])) { - $this->activeRoute['middlewaresPre'][] = $middlewareClass; - } else { - $this->activeRoute['middlewaresPost'][] = $middlewareClass; - } - } - } - } - - return $foundController; - } - - private function findRouteFromFiles($uri, $version, $locale) - { - - $foundController = null; - $front = Front::getInstance(); - - if (isset($this->allRoutesByVersionAndLocale[$version][$locale])) { - $routes = $this->allRoutesByVersionAndLocale[$version][$locale]; - - if (! $foundController) { - $routes = array_reverse($routes); - - foreach ($routes as $route) { - if (! $foundController) { - // default type is "default" - $requestType = 'default'; - - // if a specific type is requested - if (isset($route['type'])) { - $requestType = $route['type']; - } - - $routeRegexpWithoutNamedParams = preg_replace('/\([\w_]+:/', '(', $route['regexp']); - - $arrRouteModuleControllerAction = explode('/', $route['controller']); - - // make the first slash after our route directory optional - $routeTest = rtrim('/' . ltrim($routeRegexpWithoutNamedParams, '/'), '/'); - - // check if this is a match, or else continue until we have a match - if (preg_match('#^' . $routeRegexpWithoutNamedParams . '#', $uri, $refs)) { - // if using a rest request, the user can override the method - if ($requestType == 'rest') { - // default action - if (isset($_SERVER['REQUEST_METHOD'])) { - $action = strtolower($_SERVER['REQUEST_METHOD']); - } - if ($_SERVER['REQUEST_METHOD'] == 'POST') { - // overloading the method with the "method" parameter if the request is POST - if (isset($_POST['method'])) { - $action = strtolower($_POST['method']); - } - // overloading the method with http headers - // X-HTTP-Method (Microsoft) or X-HTTP-Method-Override (Google/GData) or X-METHOD-OVERRIDE (IBM) - $acceptableOverridingHeaders = array( - 'HTTP_X_HTTP_METHOD', - 'HTTP_X_HTTP_METHOD_OVERRIDE', - 'HTTP_X_METHOD_OVERRIDE' - ); - foreach ($acceptableOverridingHeaders as $overridingHeader) { - if (isset($_SERVER[$overridingHeader])) { - $action = strtolower($_SERVER[$overridingHeader]); - } - } - } - - // if overriding the action in the route - if (isset($arrRouteModuleControllerAction[2])) { - $action = $arrRouteModuleControllerAction[2]; - } - } else { - $action = $arrRouteModuleControllerAction[2]; - } - - // on teste la présence du module controller action indiqué dans la route - if ($foundController = $front->checkModuleControllerAction($arrRouteModuleControllerAction[0], $arrRouteModuleControllerAction[1], $action)) { - $this->activeRoute = $route; - $front->setRequestType($requestType); - $front->associateParams($route['regexp'], $refs); - break; - } - } - } - } - unset($route); - } - } - return $foundController; - } - - public function getAllRoutes() - { - return $this->allRoutesByVersionAndLocale; - } - - public function getActiveRoute() - { - return $this->activeRoute; - } - - // returns the url from the defined routes by its name - public function getNamedUrl($name, $params = array(), $version = null, $locale = null, $getFullUrl = true) - { - if ($version == null) { - $version = Registry::get('version'); - } - if ($locale == null) { - $locale = Registry::get('locale'); - } - // get the actual domain name from the url.ini - $domainName = ''; - if ($getFullUrl) { - if (! isset($this->allVersionsUrls[$version][$locale])) { - $urlIni = Registry::get('urlIni'); - $localeSuffix = $urlIni->suffixes->$locale; - $versionPrefix = $urlIni->versions->$version; - if (strpos($versionPrefix, '|') !== false) { - $arrVersionPrefix = explode('|', $versionPrefix); - $versionPrefix = $arrVersionPrefix[0]; - if ($versionPrefix == '<>') { - $versionPrefix = ''; - } - } - $domainName = str_replace('[version]', $versionPrefix, $localeSuffix); - if (! isset($this->allVersionsUrls[$version])) { - $this->allVersionsUrls[$version] = array(); - $this->allVersionsUrls[$version][$locale] = $domainName; - } - } else { - $domainName = $this->allVersionsUrls[$version][$locale]; - } - } - $foundRoute = false; - if (isset($this->allRoutesByVersionAndLocale[$version][$locale][$name])) { - $url = $this->allRoutesByVersionAndLocale[$version][$locale][$name]['regexp']; - $foundRoute = true; - } elseif (isset($this->allRoutesByVersionAndLocale[$version]['*'][$name])) { - $url = $this->allRoutesByVersionAndLocale[$version]['*'][$name]['regexp']; - $foundRoute = true; - } elseif (isset($this->allRoutesByVersionAndLocale['*']['*'][$name])) { - $url = $this->allRoutesByVersionAndLocale['*']['*'][$name]['regexp']; - $foundRoute = true; - } - if ($foundRoute) { - preg_match_all('/\(([\w_]+):([^)]+)\)/im', $url, $result, PREG_SET_ORDER); - for ($matchi = 0; $matchi < count($result); $matchi ++) { - if (isset($params[$result[$matchi][1]])) { - $url = str_replace($result[$matchi][0], $params[$result[$matchi][1]], $url); - } - } - if ($getFullUrl) { - return $domainName . '/' . $url; - } else { - return $url; - } - } else { - throw new \Exception('Cannot find route named "' . $name . '" (version=' . $version . ', locale=' . $locale . ')'); - } - } -} - - -namespace Nf; - -abstract class File -{ - - public static function mkdir($pathname, $mode = 0775, $recursive = false) - { - if (! is_dir($pathname)) { - $oldumask = umask(0); - $ret = @mkdir($pathname, $mode, $recursive); - umask($oldumask); - return $ret; - } - return true; - } - - public static function rename($old, $new, $mode = 0775) - { - if (is_readable($old)) { - $pathname = dirname($new); - if (! is_dir($pathname)) { - self::mkdir($pathname, $mode, true); - } - return rename($old, $new); - } - return false; - } - - public static function uncompress($src, $dest, $unlinkSrc = false) - { - $finfo = finfo_open(FILEINFO_MIME_TYPE); - $mimeType = finfo_file($finfo, $src); - finfo_close($finfo); - - switch ($mimeType) { - case 'application/x-gzip': - exec('gzip -dcf ' . $src . ($dest !== null ? ' > ' . $dest : ''), $out, $ret); - break; - - default: - return false; - } - - if (isset($ret) && $ret === 0) { - if ($unlinkSrc) { - @unlink($src); - } - } - return ($ret === 0); - } - - public static function generatePath($input, $hereMark = '@') - { - $input = '' . $input; - // 15567 => /7/15/56/7/@/ - // 6871985 => /5/68/71/98/5/@/ - // 687198565 /5/68/71/98/56/5/@/ - // 68719856 /6/68/71/98/56/@/ - // 21 /1/21/@/ - // 2121 /1/21/21/@/ - // 1 /1/1/@ - // antix /x/an/ti/x/@/ - $len = strlen($input); - if ($len == 1) { - $output = $input . '/' . $input; - } else { - $output = $input{$len - 1} . '/'; - for ($i = 0; $i < $len - 1; $i ++) { - $output .= substr($input, $i, 1); - if ($i % 2) { - $trailing = '/'; - } else { - $trailing = ''; - } - $output .= $trailing; - } - $output .= $input{$len - 1}; - } - $output .= '/' . $hereMark . '/'; - return '/' . $output; - } -} - - - -/** - * Autoloader is a class loader. - * - * - * require($library_path . '/php/classes/Nf/Autoloader.php'); - * $autoloader=new \Nf\Autoloader(); - * $autoloader->addMap($applicationPath . '/configs/map.php'); - * $autoloader->addNamespaceRoot('Nf', $libraryPath . '/Nf'); - * $autoloader->register(); - * - * - * @package Nf - * @author Julien Ricard - * @version 1.0 - **/ -namespace Nf; - -class Autoloader -{ - - protected static $_directories = array(); - - protected static $_maps = array(); - - protected static $_namespaceSeparator = '\\'; - - const defaultSuffix = '.php'; - - public function __construct() { - - } - - public static function load($className) - { - if (! class_exists($className)) { - $foundInMaps = false; - - if (count(self::$_maps) != 0) { - // reads every map for getting class path - foreach (self::$_maps as $map) { - if (isset($map[$className])) { - if (self::includeClass($map[$className], $className)) { - return true; - } else { - return false; - } - } - } - $foundInMaps = false; - } - if (! $foundInMaps) { - $namespaceRoot = ''; - $fileNamePrefix = ''; - - // reads each directory until it finds the class file - if (false !== ($lastNsPos = strripos($className, self::$_namespaceSeparator))) { - $namespace = substr($className, 0, $lastNsPos); - $namespaceRoot = substr($className, 0, strpos($className, self::$_namespaceSeparator)); - $shortClassName = substr($className, $lastNsPos + 1); - $fileNamePrefix = str_replace(self::$_namespaceSeparator, DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR; - } else { - $shortClassName = $className; - } - - $fileNamePrefix .= str_replace('_', DIRECTORY_SEPARATOR, $shortClassName); - - foreach (self::$_directories as $directory) { - if ($directory['namespaceRoot'] == $namespaceRoot && $directory['namespaceRoot'] != '') { - // use the specified directory with remaining path - $fileNamePrefix = str_replace($namespaceRoot . DIRECTORY_SEPARATOR, '', $fileNamePrefix); - if (self::includeClass($directory['path'] . $fileNamePrefix . $directory['suffix'], $className)) { - return true; - } else { - // file was not found in the specified directory - return false; - } - } elseif ($directory['namespaceRoot'] == '') { - if (self::includeClass($directory['path'] . $fileNamePrefix . $directory['suffix'], $className)) { - return true; - } - } - } - } - } else { - return true; - } - return false; - } - - public static function includeClass($file, $class_name) - { - if (! class_exists($class_name)) { - if (file_exists($file)) { - require $file; - return true; - } else { - return false; - } - } else { - // class already exists - } - } - - public static function addNamespaceRoot($namespaceRoot, $path, $suffix = self::defaultSuffix) - { - if (substr($path, - 1) != DIRECTORY_SEPARATOR) { - $path .= DIRECTORY_SEPARATOR; - } - self::$_directories[] = array( - 'namespaceRoot' => $namespaceRoot, - 'path' => $path, - 'suffix' => $suffix - ); - } - - public function addMap($mapFilePath = null) - { - global $applicationPath; - global $libraryPath; - - if($mapFilePath === null) { - $mapFilePath = $applicationPath . '/cache/autoloader.map.php'; - } - - if (file_exists($mapFilePath)) { - if (pathinfo($mapFilePath, PATHINFO_EXTENSION) == 'php') { - $newMap = require($mapFilePath); - self::$_maps[] = $newMap; - } - } - } - - public function register() - { - spl_autoload_register(__NAMESPACE__ . '\Autoloader::load'); - } -} - - - -namespace Nf; - -class Registry extends \ArrayObject -{ - - private static $_registry = null; - - /** - * Retrieves the default registry instance. - * - * @return Zend_Registry - */ - public static function getInstance() - { - if (self::$_registry === null) { - self::init(); - } - - return self::$_registry; - } - - /** - * Set the default registry instance to a specified instance. - * - * @param Zend_Registry $registry An object instance of type Zend_Registry, - * or a subclass. - * @return void - * @throws Zend_Exception if registry is already initialized. - */ - public static function setInstance(\Nf\Registry $registry) - { - if (self::$_registry !== null) { - #require_once 'Zend/Exception.php'; - throw new Exception('Registry is already initialized'); - } - - self::$_registry = $registry; - } - - /** - * Initialize the default registry instance. - * - * @return void - */ - protected static function init() - { - self::setInstance(new \Nf\Registry()); - } - - /** - * getter method, basically same as offsetGet(). - * - * This method can be called from an object of type Nf\Registry, or it - * can be called statically. In the latter case, it uses the default - * static instance stored in the class. - * - * @param string $index - get the value associated with $index - * @return mixed - * @throws Zend_Exception if no entry is registerd for $index. - */ - public static function get($index) - { - $instance = self::getInstance(); - - if (!$instance->offsetExists($index)) { - throw new \Exception("No entry is registered for key '$index'"); - } - - return $instance->offsetGet($index); - } - - /** - * setter method, basically same as offsetSet(). - * - * This method can be called from an object of type Zend_Registry, or it - * can be called statically. In the latter case, it uses the default - * static instance stored in the class. - * - * @param string $index The location in the ArrayObject in which to store - * the value. - * @param mixed $value The object to store in the ArrayObject. - * @return void - */ - public static function set($index, $value) - { - $instance = self::getInstance(); - $instance->offsetSet($index, $value); - } - - /** - * Returns TRUE if the $index is a named value in the registry, - * or FALSE if $index was not found in the registry. - * - * @param string $index - * @return boolean - */ - public static function isRegistered($index) - { - if (self::$_registry === null) { - return false; - } - return self::$_registry->offsetExists($index); - } - - /** - * Constructs a parent ArrayObject with default - * ARRAY_AS_PROPS to allow acces as an object - * - * @param array $array data array - * @param integer $flags ArrayObject flags - */ - public function __construct() - { - parent::__construct(); - } - - /** - * @param string $index - * @returns mixed - * - * Workaround for http://bugs.php.net/bug.php?id=40442 (ZF-960). - */ - public function offsetExists($index) - { - return array_key_exists($index, $this); - } -} - - - -namespace Nf; - -class UserAgent -{ - - public $httpUserAgent; - public $lowerHttpUserAgent; - - public function __construct($httpUserAgent) - { - $this->httpUserAgent=$httpUserAgent; - $this->lowerHttpUserAgent=strtolower($httpUserAgent); - } - - public function checkClass($class) - { - switch ($class) { - case 'iphone': - return $this->isIphone(); - break; - case 'ipad': - return $this->isIpad(); - break; - case 'androidmobile': - return $this->isAndroidMobile(); - break; - case 'androidtablet': - return $this->isAndroidTablet(); - break; - case 'blackberry': - return $this->isBlackberry(); - break; - } - } - - public function isIphone() - { - return strstr($this->lowerHttpUserAgent, 'iphone') || strstr($this->lowerHttpUserAgent, 'ipod'); - } - - public function isIpad() - { - return strstr($this->lowerHttpUserAgent, 'ipad'); - } - - public function isAndroidMobile() - { - return (strstr($this->lowerHttpUserAgent, 'android')!==false) && (strstr($this->lowerHttpUserAgent, 'mobile')===false); - } - - public function isAndroidTablet() - { - return (strstr($this->lowerHttpUserAgent, 'android')!==false) && (strstr($this->lowerHttpUserAgent, 'mobile')===false); - } - - public function isBlackberry() - { - return strstr($this->lowerHttpUserAgent, 'blackberry'); - } -} - - -namespace Nf; - -class Task -{ - - protected $pid; - - protected $ppid; - - protected $params = null; - - function __construct($params = null) - { - $this->params = $params; - } - - function fork() - { - $pid = pcntl_fork(); - if ($pid == - 1) - throw new Exception('fork error on Task object'); - elseif ($pid) { - // we are in the parent class - $this->pid = $pid; - // echo "< in parent with pid {$this->pid}\n"; - } else { - // we are in the child ᶘ ᵒᴥᵒᶅ - $this->ppid = posix_getppid(); - $this->pid = posix_getpid(); - $this->run(); - exit(0); - } - } - - // overload this method in your class - function run() - { - // echo "> in child {$this->pid}\n"; - } - - // call when a task is finished (in parent) - function finish() - { - // echo "task finished {$this->pid}\n"; - } - - function pid() - { - return $this->pid; - } -} - - - - - -namespace Nf; - -class Front extends Singleton -{ - - protected static $_instance; - - // les modules - private $_moduleDirectories = array(); - - const controllersDirectory = 'controllers'; - - // pour instancier le controller, forwarder... - private $_moduleNamespace; - - private $_moduleName; - - private $_controllerName; - - private $_actionName; - - // pour le controller - private $_request; - - private $_requestType; - - private $_response; - - private $_router; - - private $_session; - - public static $obLevel = 0; - - // the instance of the controller that is being dispatched - private $_controllerInstance; - - private $_applicationNamespace = 'App'; - - private $registeredMiddlewares = array(); - - const MIDDLEWARE_PRE = 0; - - const MIDDLEWARE_POST = 1; - - public function __get($var) - { - $varName = '_' . $var; - return $this->$varName; - } - - public function getRequestType() - { - return $this->_requestType; - } - - public function getModuleName() - { - return $this->_moduleName; - } - - public function getControllerName() - { - return $this->_controllerName; - } - - public function getActionName() - { - return $this->_actionName; - } - - public function setRequest($request) - { - $this->_request = $request; - } - - public function setResponse($response) - { - $this->_response = $response; - } - - public function setRequestType($requestType) - { - $this->_requestType = $requestType; - } - - public function getRequest() - { - return $this->_request; - } - - public function getResponse() - { - return $this->_response; - } - - public function setSession($session) - { - $this->_session = $session; - } - - public function getSession() - { - return $this->_session; - } - - public function getRouter() - { - return $this->_router; - } - - public function setRouter($router) - { - $this->_router = $router; - } - - public function setApplicationNamespace($namespace) - { - $this->_applicationNamespace = $namespace; - } - - public function getApplicationNamespace() - { - return $this->_applicationNamespace; - } - - public function getControllerInstance() - { - return $this->_controllerInstance; - } - - // cache - public function getCache($which) - { - // do we already have the cache object in the Registry ? - if (Registry::isRegistered('cache_' . $which)) { - return Registry::get('cache_' . $which); - } else { - // get the config for our cache object - $config = Registry::get('config'); - if (isset($config->cache->$which->handler)) { - $cache = Cache::factory($config->cache->$which->handler, (isset($config->cache->$which->params)) ? $config->cache->$which->params : array(), (isset($config->cache->$which->lifetime)) ? $config->cache->$which->lifetime : Cache::DEFAULT_LIFETIME); - return $cache; - } else { - throw new Exception('The cache handler "' . $which . '" is not set in config file'); - } - } - } - - // modules - public function addModuleDirectory($namespace, $dir) - { - $this->_moduleDirectories[] = array( - 'namespace' => $namespace, - 'directory' => $dir - ); - } - - private function getControllerFilename($namespace, $directory, $module, $controller) - { - $controllerFilename = ucfirst($controller . 'Controller.php'); - return $directory . $module . '/' . self::controllersDirectory . '/' . $controllerFilename; - } - - public function checkModuleControllerAction($inModule, $inController, $inAction) - { - $foundController = null; - - foreach ($this->_moduleDirectories as $moduleDirectory => $moduleDirectoryInfos) { - $controllerFilename = $this->getControllerFilename($moduleDirectoryInfos['namespace'], $moduleDirectoryInfos['directory'], $inModule, $inController); - - if (file_exists($controllerFilename)) { - $this->_moduleNamespace = $moduleDirectoryInfos['namespace']; - $this->_moduleName = $inModule; - $this->_controllerName = $inController; - $this->_actionName = $inAction; - $foundController = $controllerFilename; - break; - } - } - - unset($moduleDirectory); - unset($moduleDirectoryInfos); - if (! $foundController) { - return false; - } - return $foundController; - } - - public function forward($module, $controller, $action) - { - if ($foundController = $this->checkModuleControllerAction($module, $controller, $action)) { - if ($this->checkMethodForAction($foundController)) { - $this->launchAction(); - return true; - } else { - return false; - } - } else { - return false; - } - } - - public function associateParams($routeRegexp, $values) - { - if (! is_array($values)) { - $values = array( - $values - ); - } - - preg_match_all('/\((\w+):/', $routeRegexp, $matches); - - for ($i = 0; $i < count($matches[1]); $i ++) { - $this->_request->setParam($matches[1][$i], $values[$i + 1]); - } - } - - public function parseParameters($uri) - { - // les éventuels paramètres sont en /variable/value - $paramsFromUri = ltrim(preg_replace('#^(\w+)/(\w+)/(\w+)#', '', $uri), '/'); - - // si on envoie des variables avec des / - if ($paramsFromUri != '') { - if (substr_count($paramsFromUri, '/') % 2 == 1) { - preg_match_all('/(\w+)\/([^\/]*)/', $paramsFromUri, $arrParams, PREG_SET_ORDER); - for ($matchi = 0; $matchi < count($arrParams); $matchi ++) { - $this->_request->setParam($arrParams[$matchi][1], $arrParams[$matchi][2]); - } - } - - // si on envoie des variables avec des var1=val1 - if (substr_count($paramsFromUri, '=') >= 1) { - preg_match_all('/(\w+)=([^\/&]*)/', $paramsFromUri, $arrParams, PREG_SET_ORDER); - for ($matchi = 0; $matchi < count($arrParams); $matchi ++) { - $this->_request->setParam($arrParams[$matchi][1], $arrParams[$matchi][2]); - } - } - } - } - - public function getView() - { - if (! is_null($this->_controllerInstance->_view)) { - return $this->_controllerInstance->_view; - } else { - $config = Registry::get('config'); - $view = View::factory($config->view->engine); - $view->setResponse($this->_response); - return $view; - } - } - - public function dispatch() - { - // on va regarder le m/c/a concerné par l'url ou les paramètres déjà saisis - if ($foundController = $this->getRouter()->findRoute(Registry::get('version'), Registry::get('locale'))) { - return $this->checkMethodForAction($foundController); - } else { - return false; - } - } - - private function checkMethodForAction($foundController) - { - // on lancera dans l'ordre le init, action, postAction - require_once($foundController); - $controllerClassName = $this->_moduleNamespace . '\\' . ucfirst($this->_moduleName) . '\\' . ucfirst($this->_controllerName) . 'Controller'; - $this->_controllerInstance = new $controllerClassName($this); - - $reflected = new \ReflectionClass($this->_controllerInstance); - - if ($reflected->hasMethod($this->_actionName . 'Action')) { - return true; - } else { - return false; - } - } - - // called after dispatch - public function init() - { - return $this->_controllerInstance->init(); - } - - // registers a middleware programmatically and not through a route - public function registerMiddleware($middlewareInstance) - { - if (isset(class_uses($middlewareInstance)['Nf\Middleware\Pre'])) { - $key = self::MIDDLEWARE_PRE; - } else { - $key = self::MIDDLEWARE_POST; - } - // adds the middleware - $this->registeredMiddlewares[$key][] = $middlewareInstance; - } - - // calls the actual action found from the routing system - public function launchAction() - { - self::$obLevel = ob_get_level(); - - if (php_sapi_name() != 'cli') { - ob_start(); - } - - $router = $this->_router; - $activeRoute = $router->getActiveRoute(); - - // optionally sets the content-type - if (isset($activeRoute['contentType'])) { - $this->_response->setContentType($activeRoute['contentType']); - } - - // optionally sets the client cache duration - if (isset($activeRoute['cacheMinutes'])) { - $this->_response->setCacheable($activeRoute['cacheMinutes']); - } - - // call pre middlewares defined by the active route - if (isset($activeRoute['middlewaresPre'])) { - foreach ($activeRoute['middlewaresPre'] as $middleware) { - $object = new $middleware(); - $object->execute(); - } - unset($middleware); - } - // call pre middlewares defined programatically - if (isset($this->registeredMiddlewares[self::MIDDLEWARE_PRE])) { - foreach ($this->registeredMiddlewares[self::MIDDLEWARE_PRE] as $middleware) { - $middleware->execute(); - } - } - - // call the action - call_user_func(array( - $this->_controllerInstance, - $this->_actionName . 'Action' - )); - $content = ob_get_clean(); - $this->_response->addBodyPart($content); - - // call post middlewares - if (isset($activeRoute['middlewaresPost'])) { - foreach ($activeRoute['middlewaresPost'] as $middleware) { - $object = new $middleware(); - $object->execute(); - } - unset($middleware); - } - // call post middlewares defined programatically, by instance - if (isset($this->registeredMiddlewares[self::MIDDLEWARE_POST])) { - foreach ($this->registeredMiddlewares[self::MIDDLEWARE_POST] as $middleware) { - $middleware->execute(); - } - } - } - - // called after action - public function postLaunchAction() - { - $reflected = new \ReflectionClass($this->_controllerInstance); - if ($reflected->hasMethod('postLaunchAction')) { - call_user_func(array( - $this->_controllerInstance, - 'postLaunchAction' - ), null); - } - } -} - - -namespace Nf; - -abstract class Cache -{ - - static $instances = array(); - - // default lifetime for any stored value - const DEFAULT_LIFETIME = 600; - - public static function getKeyName($keyName, $keyValues = array()) - { - $config = Registry::get('config'); - if (! isset($config->cachekeys->$keyName)) { - throw new \Exception('Key ' . $keyName . ' is not set in the config file.'); - } else { - $configKey = $config->cachekeys->$keyName; - if (is_array($keyValues)) { - // if we send an associative array - if (self::isAssoc($keyValues)) { - $result = $configKey; - foreach ($keyValues as $k => $v) { - $result = str_replace('[' . $k . ']', $v, $result); - } - } else { - // if we send an indexed array - preg_match_all('/\[([^\]]*)\]/', $configKey, $vars, PREG_PATTERN_ORDER); - if (count($vars[0]) != count($keyValues)) { - throw new \Exception('Key ' . $keyName . ' contains a different number of values than the keyValues you gave.'); - } else { - $result = $configKey; - for ($i = 0; $i < count($vars[0]); $i ++) { - $result = str_replace('[' . $vars[0][$i] . ']', $keyValues[$i]); - } - } - } - } else { - // if we send only one value - $result = preg_replace('/\[([^\]]*)\]/', $keyValues, $configKey); - } - } - // if we still have [ in the key name, it means that we did not send the right parameters for keyValues - if (strpos($result, '[')) { - throw new \Exception('The cache key ' . $keyName . ' cannot be parsed with the given keyValues.'); - } else { - $keyPrefix = ! empty($config->cache->keyPrefix) ? $config->cache->keyPrefix : ''; - return $keyPrefix . $result; - } - } - - public static function isCacheEnabled() - { - $config = Registry::get('config'); - return isset($config->cache->enabled) ? (bool) $config->cache->enabled : true; - } - - private static function isAssoc($array) - { - return is_array($array) && array_diff_key($array, array_keys(array_keys($array))); - } - - public static function getStorage($type) - { - if (! in_array($type, self::$instances)) { - $config = Registry::get('config'); - if (isset($config->cache->$type->handler)) { - $handler = $config->cache->$type->handler; - } else { - throw new \Exception('The ' . $type . ' cache storage is not defined in the config file'); - } - if (isset($config->cache->$type->params)) { - $params = $config->cache->$type->params; - } else { - $params = null; - } - if (isset($config->cache->$type->lifetime)) { - $lifetime = $config->cache->$type->lifetime; - } else { - $lifetime = self::DEFAULT_LIFETIME; - } - $instance = self::factory($handler, $params, $lifetime); - self::$instances[$type]=$instance; - } - return self::$instances[$type]; - } - - public static function factory($handler, $params, $lifetime = DEFAULT_LIFETIME) - { - $className = get_class() . '\\' . ucfirst($handler); - return new $className($params, $lifetime); - } -} - - -namespace Nf; - -/** - * Reads an . - * - * - * ini file, handling sections, overwriting... - * - * @author Julien Ricard - * @package Nf - */ -class Ini -{ - - /** - * Internal storage array - * - * @var array - */ - private static $result = array(); - - /** - * Loads in the ini file specified in filename, and returns the settings in - * it as an associative multi-dimensional array - * - * @param string $filename - * The filename of the ini file being parsed - * @param boolean $process_sections - * By setting the process_sections parameter to TRUE, - * you get a multidimensional array, with the section - * names and settings included. The default for - * process_sections is FALSE - * @param string $section_name - * Specific section name to extract upon processing - * @throws Exception - * @return array|boolean - */ - public static function parse($filename, $process_sections = false, $section_name = null, $fallback_section_name = null) - { - - // load the raw ini file - // automatically caches the ini file if an opcache is present - ob_start(); - include($filename); - $str = ob_get_contents(); - ob_end_clean(); - $ini = parse_ini_string($str, $process_sections); - - // fail if there was an error while processing the specified ini file - if ($ini === false) { - return false; - } - - // reset the result array - self::$result = array(); - - if ($process_sections === true) { - // loop through each section - foreach ($ini as $section => $contents) { - // process sections contents - self::processSection($section, $contents); - } - } else { - // treat the whole ini file as a single section - self::$result = self::processSectionContents($ini); - } - - // extract the required section if required - if ($process_sections === true) { - if ($section_name !== null) { - // return the specified section contents if it exists - if (isset(self::$result[$section_name])) { - return self::bindArrayToObject(self::$result[$section_name]); - } else { - if ($fallback_section_name !== null) { - return self::bindArrayToObject(self::$result[$fallback_section_name]); - } else { - throw new \Exception('Section ' . $section_name . ' not found in the ini file'); - } - } - } - } - - // if no specific section is required, just return the whole result - return self::bindArrayToObject(self::$result); - } - - /** - * Process contents of the specified section - * - * @param string $section - * Section name - * @param array $contents - * Section contents - * @throws Exception - * @return void - */ - private static function processSection($section, array $contents) - { - // the section does not extend another section - if (stripos($section, ':') === false) { - self::$result[$section] = self::processSectionContents($contents); - - // section extends another section - } else { - // extract section names - list ($ext_target, $ext_source) = explode(':', $section); - $ext_target = trim($ext_target); - $ext_source = trim($ext_source); - - // check if the extended section exists - if (! isset(self::$result[$ext_source])) { - throw new \Exception('Unable to extend section ' . $ext_source . ', section not found'); - } - - // process section contents - self::$result[$ext_target] = self::processSectionContents($contents); - - // merge the new section with the existing section values - self::$result[$ext_target] = self::arrayMergeRecursive(self::$result[$ext_source], self::$result[$ext_target]); - } - } - - /** - * Process contents of a section - * - * @param array $contents - * Section contents - * @return array - */ - private static function processSectionContents(array $contents) - { - $result = array(); - - // loop through each line and convert it to an array - foreach ($contents as $path => $value) { - // convert all a.b.c.d to multi-dimensional arrays - $process = self::processContentEntry($path, $value); - - // merge the current line with all previous ones - $result = self::arrayMergeRecursive($result, $process); - } - - return $result; - } - - /** - * Convert a.b.c.d paths to multi-dimensional arrays - * - * @param string $path - * Current ini file's line's key - * @param mixed $value - * Current ini file's line's value - * @return array - */ - private static function processContentEntry($path, $value) - { - $pos = strpos($path, '.'); - - if ($pos === false) { - return array( - $path => $value - ); - } - - $key = substr($path, 0, $pos); - $path = substr($path, $pos + 1); - - $result = array( - $key => self::processContentEntry($path, $value) - ); - - return $result; - } - - private static function bindArrayToObject($array) - { - $return = new \StdClass(); - foreach ($array as $k => $v) { - if (is_array($v)) { - $return->$k = self::bindArrayToObject($v); - } else { - $return->$k = $v; - } - } - return $return; - } - - /** - * Merge two arrays recursively overwriting the keys in the first array - * if such key already exists - * - * @param mixed $a - * Left array to merge right array into - * @param mixed $b - * Right array to merge over the left array - * @return mixed - */ - private static function arrayMergeRecursive($a, $b, $level = 0) - { - // merge arrays if both variables are arrays - if (is_array($a) && is_array($b)) { - // loop through each right array's entry and merge it into $a - foreach ($b as $key => $value) { - if (isset($a[$key])) { - if (is_int($key) && ! is_array($value)) { - $a[] = $value; - } else { - $a[$key] = self::arrayMergeRecursive($a[$key], $value, $level + 1); - } - } else { - if ($key === 0) { - $a = array( - 0 => self::arrayMergeRecursive($a, $value, $level + 1) - ); - } else { - $a[$key] = $value; - } - } - } - } else { - // at least one of values is not an array - $a = $b; - } - return $a; - } - - /** - * Replaces text in every value of the config, recursively - * - * @param string $search - * The string to search for - * @param string $replace - * The string for replace with - * @throws Exception - * @return Ini - */ - public static function deepReplace($ini, $search, $replace) - { - if (is_object($ini)) { - foreach ($ini as $key => &$value) { - $value = self::deepReplace($value, $search, $replace); - } - } else { - $ini = str_replace($search, $replace, $ini); - return $ini; - } - return $ini; - } -} - - -/** - * Nf Input - * - */ - -namespace Nf; - -/** - * Filtering and validating for forms, input parameters, etc - * - * @author Julien Ricard - * @package Nf - */ -class Input -{ - - const F_INTEGER = 'Int'; - - const F_NATURAL = 'Natural'; - - const F_NATURALNONZERO = 'NaturalNonZero'; - - const F_ALPHA = 'Alpha'; - - const F_ALPHANUM = 'AlphaNum'; - - const F_NUMERIC = 'Numeric'; - - const F_BASE64 = 'Base64'; - - const F_REGEXP = 'Regexp'; - - const F_STRING = 'String'; - - const F_TRIM = 'Trim'; - - const F_URL = 'Url'; - - const F_STRIPTAGS = 'StripTags'; - - const F_NULL = 'NullIfEmptyString'; - - const F_BOOLEAN = 'Boolean'; - - const V_INTEGER = 'Int'; - - const V_NATURAL = 'Natural'; - - const V_NATURALNONZERO = 'NaturalNonZero'; - - const V_ALPHA = 'Alpha'; - - const V_ALPHANUM = 'AlphaNum'; - - const V_NUMERIC = 'Numeric'; - - const V_BASE64 = 'Base64'; - - const V_EQUALS = 'Equals'; - - const V_REGEXP = 'Regexp'; - - const V_REQUIRED = 'Required'; - - const V_NOTEMPTY = 'NotEmpty'; - - const V_GREATERTHAN = 'GreaterThan'; - - const V_LESSTHAN = 'LessThan'; - - const V_MINLENGTH = 'MinLength'; - - const V_MAXLENGTH = 'MaxLength'; - - const V_EXACTLENGTH = 'ExactLength'; - - const V_EMAIL = 'Email'; - - const V_MATCHES = 'Matches'; - - const V_URL = 'Url'; - - const V_DEFAULT = 'Default'; - - const V_BOOLEAN = 'Boolean'; - - /** - * An array of every input parameter - */ - private $_params = array(); - - /** - * An array of every filter instantiated for every input parameter - */ - private $_filters = array(); - - /** - * An array of every validator instantiated for every input parameter - */ - private $_validators = array(); - - /** - * An array of every parameter after filtering and validating - */ - private $_fields = array(); - - const REGEXP_ALPHA = '/[^a-z]*/i'; - - const REGEXP_ALPHANUM = '/[^a-z0-9]*/i'; - - const REGEXP_BASE64 = '%[^a-zA-Z0-9/+=]*%i'; - - const REGEXP_INT = '/^[\-+]?[0-9]+$/'; - - /** - * The constructor to use while filtering/validating input - * - * @param array $params the input paramters to filter and validate - * @param array $filters the list of filters for each parameter - * @param array $validators the list of validators for each parameter - * - * @return Input - */ - public function __construct(array $params, array $filters, array $validators) - { - $this->_params = $params; - $this->_filters = $filters; - $this->_validators = $validators; - $this->_classMethods = get_class_methods(__CLASS__); - $refl = new \ReflectionClass(__CLASS__); - $this->_classConstants = $refl->getConstants(); - } - - /** - * This method has to be called after specifying the parameters, filters and validators - * - * @param void - * - * @return bool returns true if every validator is validating, or false if any validator is not - * This method always filters before validating - */ - public function isValid() - { - // 1) filter - $this->filter(); - // 2) validate - return $this->validate(); - } - - /** - * Filters every input parameter - * - * @return void - */ - public function filter() - { - $this->metaFilterAndValidate('filter'); - } - - /** - * Validates every input parameter - * - * @return void - */ - public function validate() - { - return $this->metaFilterAndValidate('validate'); - } - - /** - * Returns every incorrect field and the corresponding validator - * - * @return array - */ - public function getMessages() - { - $messages = array(); - foreach ($this->_fields as $fieldName => $values) { - if (! $values['isValid']) { - $invalidators = array(); - foreach ($values['validators'] as $validatorName => $validatorValue) { - if (! $validatorValue) { - $invalidators[] = $validatorName; - } - } - $messages[$fieldName] = $invalidators; - unset($validator); - } - unset($fieldName); - unset($values); - } - return $messages; - } - - /** - * Returns the original input parameters - * - * @return array - */ - public function getFields() - { - return $this->_fields; - } - - /** - * Returns every input parameter after content filtering - * - * @return array - */ - public function getFilteredFields() - { - $filteredFields = array(); - foreach ($this->_fields as $fieldName => $data) { - $filteredFields[$fieldName] = $data['value']; - } - return $filteredFields; - } - - /** - * Does all the work needed to filter and validate the input parameters - * - * @param string $metaAction ("filter" or "validate") - * @return mixed - */ - private function metaFilterAndValidate($metaAction) - { - if ($metaAction == 'filter') { - $metaSource = $this->_filters; - } elseif ($metaAction == 'validate') { - $metaSource = $this->_validators; - $isValid = true; - } - - foreach ($metaSource as $paramName => $options) { - if ($metaAction == 'filter') { - $this->setField($paramName, (isset($this->_params[$paramName]) ? $this->_params[$paramName] : null)); - } - - if ($metaAction == 'validate') { - if (! isset($this->_fields[$paramName])) { - $this->setField($paramName, (isset($this->_params[$paramName]) ? $this->_params[$paramName] : null)); - } - $validators = array(); - } - - $options = (array) $options; - - foreach ($options as $option) { - // optional parameter sent to the filter/validator - // by default, it's not set - unset($optionParameter); - - if (is_array($option)) { - $optionKeys = array_keys($option); - $optionValues = array_values($option); - - // call with an alias and a parameter: array('isValidId' => '\App\Toto::validateId', 22) - if (isset($option[0]) && $optionKeys[1] == 0) { - $optionName = $optionKeys[0]; - $optionFunction = $optionValues[0]; - $optionParameter = $optionValues[1]; - } elseif ($this->isAssoc($option)) { - // call with an alias only : array('isValidId' => '\App\Toto::validateId'), - // or (if your name is Olivier D) call with the parameter as assoc : array('default' => 7), - $optionKeys = array_keys($option); - $optionValues = array_values($option); - - // if the value of the array is a function - if (isset($$optionFunction)) { - $optionName = $optionKeys[0]; - $optionFunction = $optionValues[0]; - } else { - // if the value of the array is a function (à la Olivier D) - $optionName = $optionKeys[0]; - $optionFunction = $optionKeys[0]; - $optionParameter = $optionValues[0]; - } - } else { - // call with a parameter only : array('regexp', '/[a-z]*/i') - $optionName = $option[0]; - $optionFunction = $option[0]; - $optionParameter = $option[1]; - } - } else { - $optionName = $option; - $optionFunction = $option; - } - - // if we want to validate against a method of a model - $idx = strpos($optionFunction, '::'); - if ($idx !== false) { - // find (with autoload) the class and call the method - $className = substr($optionFunction, 0, $idx); - $methodName = substr($optionFunction, $idx + 2); - if ($metaAction == 'filter') { - if (isset($optionParameter)) { - $this->setField($paramName, $className::$methodName($this->_fields[$paramName]['value'], $optionParameter)); - } else { - $this->setField($paramName, $className::$methodName($this->_fields[$paramName]['value'])); - } - } elseif ($metaAction == 'validate') { - if (isset($optionParameter)) { - $ret = $className::$methodName($this->_fields[$paramName]['value'], $optionParameter, $this); - } else { - $ret = $className::$methodName($this->_fields[$paramName]['value'], null, $this); - } - // add the validator to the validators for this field - $isValid = $isValid && $ret; - $validators[$optionName] = $ret; - } - } else { - // we will search for the function name in this class - $methodNameForOption = $metaAction . ucfirst($optionFunction); - // if the developer has used a shortname for the filter/validator - $methodNameFromConstants = (($metaAction == 'filter') ? 'F' : 'V') . '_' . strtoupper($optionFunction); - if (isset($this->_classConstants[$methodNameFromConstants])) { - $methodNameForOption = (($metaAction == 'filter') ? 'filter' : 'validate') . $this->_classConstants[$methodNameFromConstants]; - } - - if (in_array($methodNameForOption, $this->_classMethods)) { - if ($methodNameForOption == 'validateRequired') { - $ret = array_key_exists($paramName, $this->_params); - } else { - if (! isset($optionParameter)) { - $optionParameter = null; - } - if (is_array($this->_fields[$paramName]['value'])) { - if ($metaAction == 'filter') { - foreach ($this->_fields[$paramName]['value'] as $paramKey => $paramValue) { - $this->_fields[$paramName]['value'][$paramKey] = self::$methodNameForOption($this->_fields[$paramName]['value'][$paramKey], $optionParameter, $this); - } - unset($paramKey); - unset($paramValue); - $ret = $this->_fields[$paramName]['value']; - } else { - $ret = true; - foreach ($this->_fields[$paramName]['value'] as $paramKey => $paramValue) { - $ret &= self::$methodNameForOption($this->_fields[$paramName]['value'][$paramKey], $optionParameter, $this); - } - unset($paramKey); - unset($paramValue); - } - } else { - $ret = self::$methodNameForOption($this->_fields[$paramName]['value'], $optionParameter, $this); - } - } - if ($metaAction == 'filter') { - $this->setField($paramName, $ret); - } - // add the validator to the validators for this field - if ($metaAction == 'validate') { - // special case of the default value - if ($methodNameForOption == 'validateDefault') { - if (is_array($this->_fields[$paramName]['value'])) { - foreach ($this->_fields[$paramName]['value'] as $paramKey => $paramValue) { - if (empty($this->_fields[$paramName]['value'][$paramKey])) { - $this->_fields[$paramName]['value'][$paramKey] = $optionParameter; - } - } - unset($paramKey); - unset($paramValue); - $ret = true; - } else { - if (empty($this->_fields[$paramName]['value'])) { - $this->_fields[$paramName]['value'] = $optionParameter; - } - $ret = true; - } - } - $isValid = $isValid && $ret; - $validators[$optionName] = $ret; - } - } else { - throw new \Exception(__CLASS__ . ' hasn\'t a method called "' . $methodNameForOption . '"'); - } - } - } - unset($option); - - // we set the field after all the input value went through all validators - if ($metaAction == 'validate') { - // we test for each params if one of validators is not valid. - $paramIsValid = true; - foreach ($validators as $v) { - if ($v === false) { - $paramIsValid = false; - break; - } - } - $this->setField($paramName, false, $paramIsValid, $validators); - } - } - if ($metaAction == 'validate') { - return $isValid; - } - } - - /** - * After filtering or validating, updates the field with additional data - * - * @param mixed $paramName the name of the input parameter - * @param mixed $value the value after filtering - * @param boolean $isValid is the field valid - * @param array $validators sets the given validators for this parameter - * - * @return mixed - */ - private function setField($paramName, $value = false, $isValid = null, $validators = null) - { - if (! isset($this->_fields[$paramName])) { - $this->_fields[$paramName] = array( - 'originalValue' => (isset($this->_params[$paramName])) ? $this->_params[$paramName] : null, - 'value' => (isset($this->_params[$paramName])) ? $this->_params[$paramName] : null, - 'isValid' => true, - 'validators' => array() - ); - } - if ($value !== false) { - $this->_fields[$paramName]['value'] = $value; - } - if ($isValid !== null) { - $this->_fields[$paramName]['isValid'] = $this->_fields[$paramName]['isValid'] && $isValid; - } - if ($validators !== null) { - $this->_fields[$paramName]['validators'] = $validators; - } - } - - /** - * Returns the filtered value for any field given in the params - * - * @param mixed $paramName the name of the input parameter - * - * @return mixed - */ - public function __get($paramName) - { - return $this->_fields[$paramName]['value']; - } - - /** - * Returns true or false if the input parameter was specified within the instanciation - * - * @param mixed $paramName the name of the input parameter - * - * @return boolean - */ - public function __isset($paramName) - { - return isset($this->_fields[$paramName]['value']); - } - - /** - * Indicates if the array is an associative one or not - * - * @param array $paramName the name of the input parameter - * - * @return boolean - */ - private function isAssoc($array) - { - return is_array($array) && array_diff_key($array, array_keys(array_keys($array))); - } - - // ************************************************************************ - // filter functions - // ************************************************************************ - - /** - * Used for filtering integer as string in json data - * - * @param mixed $value the value of the input parameter - * - * @return mixed - */ - public static function filterNullIfEmptyString($value) - { - if ($value == '') { - return null; - } - return $value; - } - - /** - * Parses the value as an integer - * - * @param mixed $value the value of the input parameter - * @return mixed - */ - public static function filterInt($value) - { - return filter_var($value, FILTER_SANITIZE_NUMBER_INT); - } - - /** - * Parses the value as a natural (positive integer) - * - * @param mixed $value the value of the input parameter - * @return mixed - */ - public static function filterNatural($value) - { - return abs(self::filterInt($value)); - } - - /** - * Parses the value as a strict natural (strictly positive integer) - * - * @param mixed $value the value of the input parameter - * @return mixed - */ - public static function filterNaturalNonZero($value) - { - $natural = self::filterNatural($value); - if ($natural != 0) { - return $natural; - } else { - return null; - } - } - - /** - * Parses the value as alpha (letters only, no digit) - * - * @param mixed $value the value of the input parameter - * @return mixed - */ - public static function filterAlpha($value) - { - return preg_replace(self::REGEXP_ALPHA, '', $value); - } - - /** - * Parses the value as an alphanumeric - * - * @param mixed $value the value of the input parameter - * @return mixed - */ - public static function filterAlphaNum($value) - { - return preg_replace(self::REGEXP_ALPHANUM, '', $value); - } - - /** - * Parses the value as a base64 string - * - * @param mixed $value the value of the input parameter - * @return mixed - */ - public static function filterBase64($value) - { - return preg_replace(self::REGEXP_BASE64, '', $value); - } - - /** - * Parses the value as a boolean - * - * @param mixed $value the value of the input parameter - * @return mixed - */ - public static function filterBoolean($value) - { - $out = filter_var($value, FILTER_VALIDATE_BOOLEAN); - return $out; - } - - /** - * Parses the value as a float - * - * @param mixed $value the value of the input parameter - * @return mixed - */ - public static function filterNumeric($value) - { - return filter_var($value, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); - } - - /** - * Removes the html tags from input - * - * @param mixed $value the value of the input parameter - * @return mixed - */ - public static function filterStripTags($value) - { - return strip_tags($value); - } - - /** - * Parses the value along a regexp - * - * @param mixed $value the value of the input parameter - * @param string $regexp the regular expression to filter the input parameter to - - * @return mixed - */ - public static function filterRegexp($value, $regexp) - { - return preg_replace($regexp, '', $value); - } - - /** - * Parses the value as a string - * - * @param mixed $value the value of the input parameter - * @return mixed - */ - public static function filterString($value) - { - return filter_var($value, FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW); - } - - /** - * Trims the string (default php behaviour) - * - * @param mixed $value the value of the input parameter - * @return mixed - */ - public static function filterTrim($value) - { - return trim($value); - } - - /** - * Filters the input string along the php's internal regexp for a url - * - * @param mixed $value the value of the input parameter - * @return mixed - */ - public static function filterUrl($value) - { - return filter_var($value, FILTER_SANITIZE_URL); - } - - // ************************************************************************ - // validator functions - // ************************************************************************ - - /** - * Validates that the input value is an integer - * - * @param mixed $value the value of the input parameter - * @return mixed - */ - public static function validateInt($value) - { - return (self::filterInt($value) == $value); - } - - /** - * Validates that the input value is a natural - * - * @param mixed $value the value of the input parameter - * @return mixed - */ - public static function validateNatural($value) - { - return (self::filterNatural($value) == $value); - } - - /** - * Validates that the input value is a positive integer greater than zero - * - * @param mixed $value the value of the input parameter - * @return mixed - */ - public static function validateNaturalNonZero($value) - { - return (self::filterNaturalNonZero($value) == $value); - } - - /** - * Validates that the input value is alpha (letters only) - * - * @param mixed $value the value of the input parameter - * @return mixed - */ - public static function validateAlpha($value) - { - return (bool) preg_match(self::REGEXP_ALPHA, $value); - } - - /** - * Validates that the input value is an alphanumeric string - * - * @param mixed $value the value of the input parameter - * @return mixed - */ - public static function validateAlphaNum($value) - { - return (bool) preg_match(self::REGEXP_ALPHANUM, $value); - } - - /** - * Validates that the input value is a base64 string - * - * @param mixed $value the value of the input parameter - * @return mixed - */ - public static function validateBase64($value) - { - return (bool) preg_match(self::REGEXP_BASE64, $value); - } - - /** - * Validates that the input value is a boolean - * - * @param mixed $value the value of the input parameter - * @return mixed - */ - public static function validateBoolean($value) - { - return (self::filterBoolean($value) == $value); - } - - /** - * Validates that the input value is a number (float) - * - * @param mixed $value the value of the input parameter - * @return mixed - */ - public static function validateNumeric($value, $compare, $instance) - { - return (self::filterNumeric($value) == $value); - } - - /** - * Validates that the input value equals the second parameter (no type checking) - * - * @param mixed $value the value of the input parameter - * @param mixed $check the value of the second parameter - * - * @return mixed - */ - public static function validateEquals($value, $check) - { - return (bool) ($value == $check); - } - - /** - * Validates that the input value along a regular expression given as second parameter - * - * @param mixed $value the value of the input parameter - * @param string $regexp the regular expression to validate to - * @return mixed - */ - public static function validateRegexp($value, $regexp) - { - return (bool) preg_match($regexp, $value); - } - - /** - * This method actually does not exist :) and should not be called directly - * - * @param mixed $value the value of the input parameter - * @return mixed - */ - public static function validateRequired($value) - { - throw new \Exception('This method should never be called'); - } - - /** - * Validates that the input value is not an empty string - * - * @param mixed $value the value of the input parameter - * @return mixed - */ - public static function validateNotEmpty($value) - { - return ! (trim($value) === ''); - } - - /** - * Validates that the input value is greater than the given parameter - * - * @param mixed $value the value of the input parameter - * @param mixed $compare the value to compare to - * @return mixed - */ - public static function validateGreaterThan($value, $compare) - { - return ($value >= $compare); - } - - /** - * Validates that the input value is lesser than the given parameter - * - * @param mixed $value the value of the input parameter - * @param mixed $compare the value to compare to - * @return mixed - */ - public static function validateLessThan($value, $compare) - { - return ($value <= $compare); - } - - /** - * Validates that the input value has a minimum length of the given parameter - * - * @param mixed $value the value of the input parameter - * @param mixed $compare the value to compare to - * @return mixed - */ - public static function validateMinLength($value, $compare) - { - return (mb_strlen($value) >= $compare); - } - - /** - * Validates that the input value has a maximum length of the given parameter - * - * @param mixed $value the value of the input parameter - * @param mixed $compare the value to compare to - * @return mixed - */ - public static function validateMaxLength($value, $compare) - { - return (mb_strlen($value) <= $compare); - } - - /** - * Validates that the input value has the exact length of the given parameter - * - * @param mixed $value the value of the input parameter - * @param mixed $compare the value to compare to - * @return mixed - */ - public static function validateExactLength($value, $compare) - { - return (mb_strlen($value) == $compare); - } - - /** - * Validates that the input value is an e-mail address - * - * @param mixed $value the value of the input parameter - * @return mixed - */ - public static function validateEmail($value) - { - $regexp = '/^[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,4}$/i'; - return (bool) preg_match($regexp, $value); - } - - /** - * Validates that the input value matches another input parameter - * - * @param mixed $value the value of the input parameter - * @param mixed $compareField the name of the input parameter to compare to - * @param mixed $instance the instance of the Input object - * @return mixed - */ - public static function validateMatches($value, $compareField, $instance) - { - if (isset($instance->_fields[$compareField])) { - return ($value == $instance->_fields[$compareField]['value']); - } - } - - /** - * Validates that the input value is an url - * - * @param mixed $value the value of the input parameter - * @return mixed - */ - public static function validateUrl($value) - { - if (($url = parse_url($value)) && ! empty($url['scheme']) && ! empty($url['host'])) { - return true; - } - return false; - } - - /** - * Sets the field to a default value if the input value is empty - * - * @param mixed $value the value of the input parameter - * @param mixed $defaultValue the default value to assign if the input value is empty - * @return mixed - */ - public static function validateDefault($value, $defaultValue) - { - if (empty($value)) { - return $defaultValue; - } - return $value; - } -} - - - -namespace Nf; - -abstract class Date -{ - - - public static function dateFromMysql($date_origine, $return_time = false) - { - $date_output=''; - if ($return_time) { - // sous la forme 2007-12-25 14:55:36 (datetime) => on renvoie tout reformaté - if (preg_match('/^(\\d{4})\\-(\\d{2})\\-(\\d{2})\\ (\\d{2}):(\\d{2}):(\\d{2})$/', $date_origine, $matches)) { - $date_output = preg_replace('/(\\d{4})\\-(\\d{2})\\-(\\d{2})\\ (\\d{2}):(\\d{2}):(\\d{2})/', '$3/$2/$1 $4:$5:$6', $matches[0]); - } // sous la forme 2007-12-25 (date) => on renvoie une heure 00:00:00 - elseif (preg_match('/^(\\d{4})\\-(\\d{2})\\-(\\d{2})$/', $date_origine, $matches)) - $date_output = preg_replace('/(\\d{4})\\-(\\d{2})\\-(\\d{2})/', '$3/$2/$1 00:00:00', $matches[0]); - // sous la forme 25/12/2007 14:55:36 - elseif (preg_match('/^(\\d{2})\/(\\d{2})\/(\\d{4}) (\\d{2}):(\\d{2}):(\\d{2})$/', $date_origine, $matches)) - $date_output = $date_origine; - // sous la forme 25/12/2007 14:55 => on ajoute :00 - elseif (preg_match('/^(\\d{1,2})\/(\\d{1,2})\/(\\d{4}) (\\d{2}):(\\d{2})$/', $date_origine, $matches)) - $date_output = preg_replace('/^(\\d{1,2})\/(\\d{1,2})\/(\\d{4}) (\\d{2}):(\\d{2})$/', '$1/$2/$3 $4:$5:00', $matches[0]); - // sous la forme 25/12/2007 => on ajoute 00:00:00 - elseif (preg_match('/^(\\d{1,2})\/(\\d{1,2})\/(\\d{4})$/', $date_origine, $matches)) - $date_output = preg_replace('/^(\\d{1,2})\/(\\d{1,2})\/(\\d{4})$/', '$1/$2/$3 00:00:00', $matches[0]); - } else { - // sous la forme 2007-12-25 (qqch)? - if (preg_match('/(\\d{4})\\-(\\d{2})\\-(\\d{2})/', $date_origine, $matches)) { - $date_output = preg_replace('/(\\d{4})\\-(\\d{2})\\-(\\d{2})/', '$3/$2/$1', $matches[0]); - } // sous la forme 25/12/2007 => on ajoute 00:00:00 - elseif (preg_match('/(\\d{1,2})\/(\\d{1,2})\/(\\d{4})/', $date_origine, $matches)) - $date_output = preg_replace('/^(\\d{1,2})\/(\\d{1,2})\/(\\d{4})$/', '$1/$2/$3', $matches[0]); - } - if ($date_output!='') { - return $date_output; - } else { - throw new \Exception('Erreur date_from_mysql : date non reconnue ' . $date_origine); - } - } - - public static function dateRange($first, $last, $step = '+1 day') - { - - $dates = array(); - $current = strtotime($first); - $last = strtotime($last); - - switch ($step) { - case '+1 day': - $format = 'Y-m-d'; - break; - case '+1 month': - $format = 'Y-m-01'; - break; - case '+1 year': - $format = 'Y-01-01'; - break; - default: - $format = 'Y-m-d'; - } - - while ($current <= $last) { - $dates[] = date($format, $current); - $current = strtotime($step, $current); - } - - return $dates; - } - - public static function dateToMysql($date_origine, $return_time = false) - { - - $date_output=''; - if ($return_time) { - // sous la forme 25/12/2007 14:55:36 => on reformate tout - if (preg_match('/^(\\d{2})\/(\\d{2})\/(\\d{4}) (\\d{2}):(\\d{2}):(\\d{2})$/', $date_origine, $matches)) { - $date_output = preg_replace('/^(\\d{2})\/(\\d{2})\/(\\d{4}) (\\d{2}):(\\d{2}):(\\d{2})$/', '$3-$2-$1 $4:$5:$6', $matches[0]); - } // sous la forme 25/12/2007 14:55 => on ajoute :00 - elseif (preg_match('/^(\\d{1,2})\/(\\d{1,2})\/(\\d{4}) (\\d{2}):(\\d{2})$/', $date_origine, $matches)) - $date_output = preg_replace('/^(\\d{1,2})\/(\\d{1,2})\/(\\d{4}) (\\d{2}):(\\d{2})$/', '$3-$2-$1 $4:$5:00', $matches[0]); - // sous la forme 25/12/2007 => on ajoute 00:00:00 - elseif (preg_match('/^(\\d{1,2})\/(\\d{1,2})\/(\\d{4})$/', $date_origine, $matches)) - $date_output = preg_replace('/^(\\d{1,2})\/(\\d{1,2})\/(\\d{4})$/', '$3-$2-$1 00:00:00', $matches[0]); - // sous la forme time() numérique - elseif (is_numeric($date_origine)) { - $date_output = date("Y-m-d H:i:s", $date_origine); - } // sous la forme mysql datetime - elseif (preg_match('/^(\\d{4})-(\\d{2})-(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})$/', $date_origine, $matches)) - $date_output = preg_replace('/(\\d{4})-(\\d{2})-(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})/', '$1-$2-$3 $4:$5:$6', $matches[0]); - // sous la forme mysql date - elseif (preg_match('/^(\\d{4})-(\\d{2})-(\\d{2})$/', $date_origine, $matches)) - $date_output = preg_replace('/(\\d{4})-(\\d{2})-(\\d{2})/', '$1-$2-$3 00:00:00', $matches[0]); - } else { - if (preg_match('/(\\d{1,2})\/(\\d{1,2})\/(\\d{4})/', $date_origine, $matches)) { - $date_output = preg_replace('/(\\d{1,2})\/(\\d{1,2})\/(\\d{4})/', '$3-$2-$1', $matches[0]); - } // sous la forme d'une timestamp numérique - elseif (is_numeric($date_origine)) - $date_output = date("Y-m-d", $date_origine); - // sous la forme mysql datetime - elseif (preg_match('/^(\\d{4})-(\\d{2})-(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})$/', $date_origine, $matches)) - $date_output = preg_replace('/(\\d{4})-(\\d{2})-(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})/', '$1-$2-$3', $matches[0]); - // sous la forme mysql date - elseif (preg_match('/^(\\d{4})-(\\d{2})-(\\d{2})$/', $date_origine, $matches)) - $date_output = preg_replace('/(\\d{4})-(\\d{2})-(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})/', '$1-$2-$3', $matches[0]); - } - if ($date_output!='') { - return $date_output; - } elseif ($date_output=='') { - return null; - } else { - throw new \Exception('Erreur date_to_mysql : date non reconnue ' . $date_origine); - } - } -} - - - -namespace Nf; - -abstract class View extends Singleton -{ - - protected static $_instance; - - private $_vars=array(); - - private $_templateDirectory=null; - private $_configDirectory=null; - - protected $_response; - - public function setResponse($response) - { - $this->_response=$response; - } - - public static function factory($name) - { - $className='\\Nf\\View\\' . ucfirst($name); - $view=$className::getInstance(); - return $view; - } -} - - -namespace Nf; - -use Nf\Localization; - -/** - * Bootstrap is responsible for instanciating the application in cli or web environment - * - * @package Nf - * - */ -class Bootstrap -{ - - const DEFAULT_LOCALESELECTIONORDER = 'cookie,url,browser'; - - private $_localeAndVersionFromUrlCache = null; - - private $_applicationNamespace = 'App'; - - public function __construct($libraryPath, $applicationPath) - { - Registry::set('libraryPath', $libraryPath); - Registry::set('applicationPath', $applicationPath); - } - - public function initHttpEnvironment($inEnvironment = null, $inLocale = null, $inVersion = null) - { - $urlIni = Ini::parse(Registry::get('applicationPath') . '/configs/url.ini', true); - Registry::set('urlIni', $urlIni); - - // environment : dev, test, prod - // si il est défini en variable d'environnement - if (empty($inEnvironment)) { - if (getenv('environment') != '') { - $environment = getenv('environment'); - } else { - // sinon on lit le fichier url.ini - if (! empty($_SERVER['HTTP_HOST'])) { - if (preg_match($urlIni->environments->dev->regexp, $_SERVER['HTTP_HOST'])) { - $environment = 'dev'; - } elseif (preg_match($urlIni->environments->test->regexp, $_SERVER['HTTP_HOST'])) { - $environment = 'test'; - } else { - $environment = 'prod'; - } - } else { - trigger_error('Cannot guess the requested environment'); - } - } - } else { - // aucune vérification pour le moment - $environment = $inEnvironment; - } - - // locale - if (! empty($urlIni->i18n->$environment->localeSelectionOrder)) { - $localeSelectionOrder = $urlIni->i18n->$environment->localeSelectionOrder; - } else { - $localeSelectionOrder = self::DEFAULT_LOCALESELECTIONORDER; - } - $localeSelectionOrderArray = (array) explode(',', $localeSelectionOrder); - // 3 possibilities : suivant l'url ou suivant un cookie ou suivant la langue du navigateur (fonctionnement indiqué dans i18n de url.ini) - if (empty($inLocale)) { - $locale = null; - foreach ($localeSelectionOrderArray as $localeSelectionMethod) { - if ($locale === null) { - switch ($localeSelectionMethod) { - case 'browser': - // on utilise la locale du navigateur et on voit si on a une correspondance - if (! empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { - // vérification de la syntaxe par une regexp - if (preg_match('/[a-z]+[_\-]?[a-z]+[_\-]?[a-z]+/i', $_SERVER['HTTP_ACCEPT_LANGUAGE'], $matches)) { - $locale = Localization::normalizeLocale($matches[0]); - if (! empty($_SERVER['HTTP_HOST'])) { - $httpHost = strtolower($_SERVER['HTTP_HOST']); - list ($localeFromUrl, $versionFromUrl, $redirectToHost) = $this->getLocaleAndVersionFromUrl($httpHost, $urlIni); - } - } - } - break; - case 'url': - // lire le fichier url.ini pour connaître la locale à utiliser - // en fonction de l'url - if (! empty($_SERVER['HTTP_HOST'])) { - $httpHost = strtolower($_SERVER['HTTP_HOST']); - list ($localeFromUrl, $versionFromUrl, $redirectToHost) = $this->getLocaleAndVersionFromUrl($httpHost, $urlIni); - if (! empty($localeFromUrl)) { - $locale = $localeFromUrl; - } - } - break; - case 'cookie': - // lire le cookie pour connaître la locale à utiliser - if (! empty($_COOKIE['_nfLc'])) { - // vérification de la syntaxe par une regexp - if (preg_match('/[a-z]+[_\-]?[a-z]+[_\-]?[a-z]+/i', $_COOKIE['_nfLc'], $matches)) { - $locale = Localization::normalizeLocale($matches[0]); - } - } - break; - } - } - } - } else { - $locale = $inLocale; - } - - // if we did not find the locale, we use the default value - if ($locale == null) { - if (! empty($urlIni->i18n->defaultLocale)) { - $locale = $urlIni->i18n->defaultLocale; - } else { - throw new \Exception('You have to set a default locale in url.ini'); - } - } - // we match the locale with the defined locale - $localeFound = false; - foreach ($urlIni->locales as $definedLocale => $definedLocaleNames) { - if (! $localeFound) { - if (strpos($definedLocaleNames, '|')) { - $arrDefinedLocaleNames = explode('|', $definedLocaleNames); - foreach ($arrDefinedLocaleNames as $localeNameOfArr) { - if (trim($localeNameOfArr) == trim($locale)) { - $locale = trim($definedLocale); - $localeFound = true; - break; - } - } - } else { - if (trim($definedLocaleNames) == trim($locale)) { - $locale = trim($definedLocale); - $localeFound = true; - break; - } - } - } - } - - // if the detected locale was not found in our defined locales - if (! $localeFound) { - // reverting to the default locale - if (! empty($urlIni->i18n->defaultLocale)) { - $locale = $urlIni->i18n->defaultLocale; - } else { - throw new \Exception('You have to set a default locale in url.ini'); - } - } - - // version (web, mobile, cli...) - if (empty($inVersion)) { - if (! empty($versionFromUrl)) { - $version = $versionFromUrl; - } else { - if (in_array('url', $localeSelectionOrderArray)) { - if (! empty($_SERVER['HTTP_HOST'])) { - $httpHost = strtolower($_SERVER['HTTP_HOST']); - list ($localeFromUrl, $versionFromUrl, $redirectToHost) = $this->getLocaleAndVersionFromUrl($httpHost, $urlIni); - } - } - if (! empty($versionFromUrl)) { - $version = $versionFromUrl; - } else { - // on prend la version par défaut si elle est définie - if (isset($urlIni->i18n->defaultVersion)) { - $version = $urlIni->i18n->defaultVersion; - } else { - trigger_error('Cannot guess the requested version'); - } - } - } - } else { - $version = $inVersion; - } - - // on assigne les variables d'environnement et de language en registry - Registry::set('environment', $environment); - Registry::set('locale', $locale); - Registry::set('version', $version); - - // on lit le config.ini à la section concernée par notre environnement - $config = Ini::parse(Registry::get('applicationPath') . '/configs/config.ini', true, $locale . '_' . $environment . '_' . $version, 'common'); - Registry::set('config', $config); - - if (! empty($redirectToHost)) { - header("HTTP/1.1 301 Moved Permanently"); - header("Location: http://" . $redirectToHost . $_SERVER['REQUEST_URI']); - return false; - } - - // prevention contre l'utilisation de index.php - if (isset($_SERVER['REQUEST_URI']) && in_array($_SERVER['REQUEST_URI'], array( - 'index.php', - '/index.php' - ))) { - header("HTTP/1.1 301 Moved Permanently"); - header("Location: /"); - return false; - } - - return true; - } - - private function getLocaleAndVersionFromUrl($httpHost, $urlIni) - { - $redirectToHost = null; - - if (! empty($this->_localeAndVersionFromUrlCache)) { - return $this->_localeAndVersionFromUrlCache; - } else { - $localeFromUrl = ''; - $versionFromUrl = ''; - - $found = false; - - foreach ($urlIni->versions as $version_name => $prefix) { - if (! $found) { - $redirectToHost = null; - foreach ($urlIni->suffixes as $locale => $suffix) { - if (! $found) { - if ($suffix != '') { - // the hosts names to test - $httpHostsToTest = array(); - if ($prefix == '') { - $httpHostsToTest = array( - ltrim(str_replace('[version]', '', $suffix), '.') - ); - } else { - if (strpos($prefix, '|') !== false) { - $prefixes = array_values(explode('|', $prefix)); - $redirectToHost = ltrim(str_replace('..', '.', ($prefixes[0] == '<>' ? str_replace('[version]', '', $suffix) : str_replace('[version]', $prefixes[0] . '.', $suffix))), '.'); - foreach ($prefixes as $thePrefix) { - // default empty prefix - if ($thePrefix == '<>') { - $httpHostsToTest[] = ltrim(str_replace('..', '.', str_replace('[version]', '', $suffix)), '.'); - } else { - $httpHostsToTest[] = ltrim(rtrim(str_replace('..', '.', str_replace('[version]', $thePrefix . '.', $suffix)), '.'), '.'); - } - } - } else { - $redirectToHost = null; - $httpHostsToTest[] = ltrim(rtrim(str_replace('..', '.', str_replace('[version]', str_replace('<>', '', $prefix) . '.', $suffix)), '.'), '.'); - } - } - } else { - if (strpos($prefix, '|') !== false) { - $prefixes = array_values(explode('|', $prefix)); - foreach ($prefixes as $thePrefix) { - $httpHostsToTest[] = $thePrefix; - } - } else { - $httpHostsToTest[] = $prefix; - } - } - - // le test sur la chaîne reconstruite - foreach ($httpHostsToTest as $httpHostToTest) { - if ($httpHost == $httpHostToTest) { - $localeFromUrl = $locale; - - $versionFromUrl = $version_name; - if ($locale == '_default') { - $localeFromUrl = $urlIni->i18n->defaultLocale; - } - if ($httpHostToTest == $redirectToHost) { - $redirectToHost = null; - } - $found = true; - break; - } - } - } - } - } else { - break; - } - unset($suffix); - } - - unset($prefix); - $this->_localeAndVersionFromUrlCache = array( - $localeFromUrl, - $versionFromUrl, - $redirectToHost - ); - } - - return array( - $localeFromUrl, - $versionFromUrl, - $redirectToHost - ); - } - - public function setApplicationNamespace($namespace) - { - $this->_applicationNamespace = $namespace; - \Nf\Registry::set('applicationNamespace', $namespace); - } - - public function initCliEnvironment() - { - $showUsage = true; - - if (isset($_SERVER['argv']) && $_SERVER['argc'] >= 2) { - $urlIni = Ini::parse(Registry::get('applicationPath') . '/configs/url.ini', true); - Registry::set('urlIni', $urlIni); - - $inEnvironment = 'dev'; - $inLocale = $urlIni->i18n->defaultLocale; - $inVersion = 'cli'; - $inAction = array( - 'type' => 'default', - 'uri' => null - ); - - // default values - Registry::set('environment', $inEnvironment); - Registry::set('locale', $inLocale); - Registry::set('version', $inVersion); - - $arrParams = array(); - - $ac = 1; - while ($ac < (count($_SERVER['argv']))) { - switch ($_SERVER['argv'][$ac]) { - case '-e': - case '--environment': - $inEnvironment = $_SERVER['argv'][$ac + 1]; - $ac += 2; - break; - case '-l': - case '--locale': - $inLocale = $_SERVER['argv'][$ac + 1]; - $ac += 2; - break; - case '-v': - case '--version': - $inVersion = $_SERVER['argv'][$ac + 1]; - $ac += 2; - break; - case '-a': - case '--action': - $inAction['uri'] = ltrim($_SERVER['argv'][$ac + 1], '/'); - $ac += 2; - $showUsage = false; - break; - case '-m': - case '--make': - $inAction['uri'] = ltrim($_SERVER['argv'][$ac + 1], '/'); - $inAction['type'] = 'make'; - $showUsage = false; - $ac += 2; - break; - default: - $ac += 2; - break; - } - } - } - - if (! $showUsage) { - // on lit le config.ini à la section concernée par notre environnement - $config = Ini::parse(Registry::get('applicationPath') . '/configs/config.ini', true, $inLocale . '_' . $inEnvironment . '_' . $inVersion); - Registry::set('config', $config); - - // on assigne les variables d'environnement et de langue en registry - Registry::set('environment', $inEnvironment); - Registry::set('locale', $inLocale); - Registry::set('version', $inVersion); - - return $inAction; - } else { - echo "Usage : module/controller/action"; - echo "\nOr : module/controller/action -variable1 value1 -variable2 value2 -variable3 value3"; - echo "\nOr : module/controller/action/variable1/value1/variable2/value2/variable3/value3"; - exit(04); - } - } - - function redirectForUserAgent() - { - if (isset($_SERVER['HTTP_USER_AGENT'])) { - $userAgent = new \Nf\UserAgent($_SERVER['HTTP_USER_AGENT']); - // check the [redirections] section of the url.ini against the userAgent and redirect if we've been told to - $urlIni = Registry::get('urlIni'); - foreach ($urlIni->redirections as $class => $forcedVersion) { - if ($userAgent->checkClass($class)) { - if (! empty($forcedVersion)) { - // get the redirection URL according to the current class - $suffixes = (array) $urlIni->suffixes; - $versions = (array) $urlIni->versions; - if ($forcedVersion != $this->_localeAndVersionFromUrlCache[1]) { - $redirectionUrl = 'http://' . str_replace('[version]', $versions[$forcedVersion], $suffixes[$this->_localeAndVersionFromUrlCache[0]]); - $response = new Front\Response\Http(); - $response->redirect($redirectionUrl, 301); - $response->sendHeaders(); - return true; - } - } - } - } - } - return false; - } - - function go() - { - if (php_sapi_name() == 'cli') { - $inAction = $this->initCliEnvironment(); - - $uri = $inAction['uri']; - Error\Handler::setErrorDisplaying(); - $front = Front::getInstance(); - - $request = new Front\Request\Cli($uri); - $front->setRequest($request); - - $request->setAdditionalCliParams(); - - $response = new Front\Response\Cli(); - - $front->setResponse($response); - $front->setApplicationNamespace($this->_applicationNamespace); - - $this->setTimezone(); - - // routing - $router = Router::getInstance(); - $front->setRouter($router); - $router->addAllRoutes(); - - // order in finding routes - $router->setStructuredRoutes(); - - $front->addModuleDirectory($this->_applicationNamespace, Registry::get('applicationPath') . '/application/cli/'); - $front->addModuleDirectory('library', Registry::get('libraryPath') . '/php/application/cli/'); - - $labelManager = LabelManager::getInstance(); - $labelManager->loadLabels(Registry::get('locale')); - - $localization = Localization::getInstance(); - $localization->setLocale(Registry::get('locale')); - - if ($inAction['type'] == 'default') { - $testDispatch = $front->dispatch(); - - if ($testDispatch) { - if ($front->init() !== false) { - $front->launchAction(); - $front->postLaunchAction(); - } - $response->sendResponse(); - } else { - throw new \Exception('Action not found : ' . $uri); - } - } else { - $front->parseParameters($inAction['uri']); - $className = array(); - - // $inAction['uri'] might be a class name with a static method like \Nf\Make::compress - if ((strpos($inAction['uri'], '\\') !== false)) { - if (strpos($inAction['uri'], '::') === false) { - throw new \Exception('You have to specify the model and method to call, or just choose a method from the "Nf\Make" class.'); - } else { - $uriSplit = explode('::', $inAction['uri']); - $className = $uriSplit[0]; - $methodName = $uriSplit[1]; - $obj = new $className(); - $className::$methodName(); - } - } else { - // or an already integrated method in Nf\Make - $methodName = $inAction['uri']; - \Nf\Make::$methodName(); - } - } - } else { - $this->initHttpEnvironment(); - - Error\Handler::setErrorDisplaying(); - - if (! $this->redirectForUserAgent()) { - $front = Front::getInstance(); - $request = new Front\Request\Http(); - - $front->setRequest($request); - $response = new Front\Response\Http(); - $front->setResponse($response); - $front->setApplicationNamespace($this->_applicationNamespace); - - $this->setTimezone(); - - // routing - $router = Router::getInstance(); - $front->setRouter($router); - $router->addAllRoutes(); - - // order in finding routes - $router->setRoutesFromFiles(); - $router->setRootRoutes(); - $router->setStructuredRoutes(); - - // modules directory for this version - $front->addModuleDirectory($this->_applicationNamespace, Registry::get('applicationPath') . '/application/' . Registry::get('version') . '/'); - $front->addModuleDirectory('library', Registry::get('libraryPath') . '/php/application/' . Registry::get('version') . '/'); - - $config = Registry::get('config'); - if (isset($config->session->handler)) { - $front->setSession(Session::start()); - } - - $labelManager = LabelManager::getInstance(); - $labelManager->loadLabels(Registry::get('locale')); - - $localization = Localization::getInstance(); - Localization::setLocale(Registry::get('locale')); - - $testDispatch = $front->dispatch(); - - $requestIsClean = $request->sanitizeUri(); - - if ($requestIsClean) { - if ($testDispatch === true) { - $request->setPutFromRequest(); - - if (! $request->redirectForTrailingSlash()) { - if ($front->init() !== false) { - if (! $front->response->isRedirect()) { - $front->launchAction(); - } - if (! $front->response->isRedirect()) { - $front->postLaunchAction(); - } - } - } - } else { - Error\Handler::handleNotFound(404); - } - } else { - Error\Handler::handleForbidden(403); - } - $response->sendResponse(); - } - } - } - - private function setTimezone() { - $config = Registry::get('config'); - if(isset($config->date->timezone)) { - try { - date_default_timezone_set($config->date->timezone); - } - catch(\Exception $e) { - echo 'timezone set failed (' . $config->date->timezone . ') is not a valid timezone'; - } - } - } - -} - - - -namespace Nf; - -abstract class Image -{ - - public static function generateThumbnail($imagePath, $thumbnailPath, $thumbnailWidth = 100, $thumbnailHeight = 100, $cut = false) - { - - // load the original image - $image = new \Imagick($imagePath); - - // undocumented method to limit imagick to one cpu thread - $image->setResourceLimit(6, 1); - - // get the original dimensions - $width = $image->getImageWidth(); - $height = $image->getImageHeight(); - - // the image will not be cut and the final dimensions will be within the requested dimensions - if (!$cut) { - // width & height : maximums and aspect ratio is maintained - if ($thumbnailHeight==0) { - $r=$width/$height; - $thumbnailHeight=ceil($thumbnailWidth/$r); - // create the thumbnail - $image->thumbnailImage($thumbnailWidth, $thumbnailHeight); - } elseif ($thumbnailWidth==0) { - $r=$width/$height; - $thumbnailWidth=ceil($thumbnailHeight*$r); - // create thumbnail - $image->thumbnailImage($thumbnailWidth, $thumbnailHeight); - } else { - // determine which dimension to fit to - $fitWidth = ($thumbnailWidth / $width) < ($thumbnailHeight / $height); - // create thumbnail - $image->thumbnailImage( - $fitWidth ? $thumbnailWidth : 0, - $fitWidth ? 0 : $thumbnailHeight - ); - } - } else { - if ($thumbnailWidth==0 || $thumbnailHeight==0) { - throw new \Exception('Cannot generate thumbnail in "cut" mode when a dimension equals zero. Specify the dimensions.'); - } - - // scale along the smallest side - $r=$width/$height; - if ($r<1) { - $newWidth=$thumbnailWidth; - $newHeight=ceil($thumbnailWidth/$r); - } else { - $newWidth=ceil($thumbnailHeight*$r); - $newHeight=$thumbnailHeight; - } - - $image->thumbnailImage($newWidth, $newHeight); - $width=$newWidth; - $height=$newHeight; - - $workingImage=$image->getImage(); - $workingImage->contrastImage(50); - $workingImage->setImageBias(10000); - $kernel = array( 0,-1,0, - -1,4,-1, - 0,-1,0); - - $workingImage->convolveImage($kernel); - - $x=0; - $y=0; - $sliceLength=16; - - while ($width-$x>$thumbnailWidth) { - $sliceWidth=min($sliceLength, $width - $x - $thumbnailWidth); - $imageCopy1=$workingImage->getImage(); - $imageCopy2=$workingImage->getImage(); - $imageCopy1->cropImage($sliceWidth, $height, $x, 0); - $imageCopy2->cropImage($sliceWidth, $height, $width - $sliceWidth, 0); - - if (self::entropy($imageCopy1) < self::entropy($imageCopy2)) { - $x+=$sliceWidth; - } else { - $width-=$sliceWidth; - } - } - - while ($height-$y>$thumbnailHeight) { - $sliceHeight=min($sliceLength, $height - $y - $thumbnailHeight); - $imageCopy1=$workingImage->getImage(); - $imageCopy2=$workingImage->getImage(); - $imageCopy1->cropImage($width, $sliceHeight, 0, $y); - $imageCopy2->cropImage($width, $sliceHeight, 0, $height - $sliceHeight); - - if (self::entropy($imageCopy1) < self::entropy($imageCopy2)) { - $y+=$sliceHeight; - } else { - $height-=$sliceHeight; - } - } - - $image->cropImage($thumbnailWidth, $thumbnailHeight, $x, $y); - } - - if ($thumbnailPath!=null) { - $image->writeImage($thumbnailPath); - $image->clear(); - $image->destroy(); - return $thumbnailPath; - } else { - return $image; - } - - } - - private static function entropy($image) - { - $image->setImageType(\Imagick::IMGTYPE_GRAYSCALE); - $pixels=$image->getImageHistogram(); - $hist=array(); - foreach ($pixels as $p) { - $color = $p->getColor(); - $theColor=$color['r']; - if (!isset($hist[$theColor])) { - $hist[$theColor]=0; - } - $hist[$theColor]+=$p->getColorCount(); - } - // calculate the entropy from the histogram - // cf http://www.mathworks.com/help/toolbox/images/ref/entropy.html - $entropy=0; - foreach ($hist as $c => $v) { - $entropy-=$v*log($v, 2); - } - return $entropy; - } - - public static function identifyImage($sourceFile) - { - return \Imagick::identifyImage($sourceFile); - } -} - - - -namespace Nf; - -class LabelManager extends Singleton -{ - - protected static $_instance; - - private $_labelsLoaded=false; - private $_labels=array(); - - // load the labels - public function loadLabels($locale, $force = false) - { - if (!$this->_labelsLoaded || $force) { - if (file_exists(\Nf\Registry::get('applicationPath') . '/labels/' . $locale . '.ini')) { - $this->_labels=parse_ini_file(\Nf\Registry::get('applicationPath') . '/labels/' . $locale . '.ini', true); - $this->_labelsLoaded=true; - } else { - throw new \Exception('Cannot load labels for this locale (' . $locale . ')'); - } - } - } - - public static function get($lbl) - { - $instance=self::$_instance; - return $instance->_labels[$lbl]; - } - - public static function getAll($section = null) - { - $instance=self::$_instance; - if ($section!=null) { - return $instance->_labels[$section]; - } else { - return $instance->_labels; - } - } - - public function __get($lbl) - { - return $this->_labels[$lbl]; - } -} - - - -namespace Nf\Middleware; - -trait Pre -{ - -} - - -namespace Nf\Middleware; - -interface MiddlewareInterface -{ - - public function execute(); -} - - -namespace Nf\Profiler; - -class File extends ProfilerAbstract -{ - - protected $handle = null; - - protected $filepath = '/tmp/profiler.log'; - - public function __construct($config) - { - if (isset($config['file'])) { - $this->filepath = $config['file']; - } - $this->handle = fopen($this->filepath, 'a'); - } -} - - - -namespace Nf\Middleware; - -trait Post -{ - -} - - - -namespace Nf\Session; - -use Nf\Session; -use Nf\Cache; - -class Memcached extends Session -{ - protected static $_instance=null; - - private $_lifeTime; - private $_memcache; - - function __construct($params, $lifetime) - { - register_shutdown_function('session_write_close'); - $this->_memcache = new \Memcache; - $this->_lifeTime = $lifetime; - if (strpos($params->hosts, ',')>0) { - $hosts=explode(',', $params->hosts); - foreach ($hosts as $host) { - $this->_memcache->addServer($host, $params->port); - } - unset($host); - } else { - $this->_memcache->addServer($params->hosts, $params->port); - } - } - - function open($savePath, $sessionName) - { - - } - - function close() - { - $this->_memcache = null; - return true; - } - - function read($sessionId) - { - $sessionId = session_id(); - $cacheKey = Cache::getKeyName('session', $sessionId); - if ($sessionId !== "") { - return $this->_memcache->get($cacheKey); - } - } - - function write($sessionId, $data) - { - // This is called upon script termination or when session_write_close() is called, which ever is first. - $cacheKey = Cache::getKeyName('session', $sessionId); - $result = $this->_memcache->set($cacheKey, $data, false, $this->_lifeTime); - return $result; - } - - function destroy($sessionId) - { - $cacheKey=Cache::getKeyName('session', $sessionId); - $this->_memcache->delete($cacheKey, 0); - return true; - } - - function gc($notUsedInMemcached) - { - return true; - } -} - - -namespace Nf\View; - -use Nf\View; - -class Smarty extends View -{ - - protected static $_instance; - - private $_smarty = null; - - const FILE_EXTENSION = '.tpl'; - - private $_vars = array(); - - protected function __construct() - { - require_once \Nf\Registry::get('libraryPath') . '/php/classes/Smarty/Smarty.class.php'; - $this->_smarty = new \Smarty(); - $front = \Nf\Front::getInstance(); - $this->setBasePath($front->getModuleName()); - } - - /** - * Return the template engine object, if any - * - * @return mixed - */ - public function getEngine() - { - return $this->_smarty; - } - - public function configLoad($filepath, $section = null) - { - $lang = \Nf\Registry::getInstance()->get('lang'); - $config_path = realpath(Registry::get('applicationPath') . '/configs/' . $lang . '/' . $front->getModuleName() . '/' . $filepath); - $this->_smarty->config_load($config_path, $section); - } - - /** - * Assign a variable to the view - * - * @param string $key - * The variable name. - * @param mixed $val - * The variable value. - * @return void - */ - public function __set($key, $val) - { - if ('_' == substr($key, 0, 1)) { - throw new Exception('Setting private var is not allowed', $this); - } - if ($this->_smarty == null) { - throw new Exception('Smarty is not defined', $this); - } - $this->_smarty->assignByRef($key, $val); - return; - } - - public function __get($key) - { - if ('_' == substr($key, 0, 1)) { - throw new Exception('Setting private var is not allowed', $this); - } - if ($this->_smarty == null) { - throw new Exception('Smarty is not defined', $this); - } - return $this->_smarty->getTemplateVars($key); - } - - /** - * Allows testing with empty() and - * isset() to work - * - * @param string $key - * @return boolean - */ - public function __isset($key) - { - $vars = $this->_smarty->getTemplateVars(); - return isset($vars[$key]); - } - - /** - * Allows unset() on object properties to work - * - * @param string $key - * @return void - */ - public function __unset($key) - { - $this->_smarty->clearAssign($key); - } - - /** - * Clear all assigned variables - * - * Clears all variables assigned to - * Zend_View either via {@link assign()} or - * property overloading ({@link __get()}/{@link __set()}). - * - * @return void - */ - public function clearVars() - { - $this->_smarty->clearAllAssign(); - } - - /** - * Processes a view script and returns the output. - * - * @param string $name - * The script script name to process. - * @return string The script output. - */ - public function render($name) - { - $this->_response->addBodyPart($this->fetch($name)); - } - - public function fetch($name) - { - return $this->_smarty->fetch($name . self::FILE_EXTENSION); - } - - public function setBasePath($path) - { - $config = \Nf\Registry::get('config'); - - // configuration de Smarty - $this->_smarty->setTemplateDir(array( - \Nf\Registry::get('applicationPath') . '/application/' . \Nf\Registry::get('version') . '/' . $path . '/views/', - \Nf\Registry::get('libraryPath') . '/php/application/' . \Nf\Registry::get('version') . '/' . $path . '/views/' - )); - - // répertoire du cache Smarty - $cacheDirectory = realpath(\Nf\Registry::get('applicationPath')) . '/cache/smarty/' . \Nf\Registry::get('version') . '/' . \Nf\Registry::get('locale') . '/' . $path . '/'; - // répertoire des templates compilés - $compileDirectory = realpath(\Nf\Registry::get('applicationPath')) . '/cache/templates_c/' . \Nf\Registry::get('version') . '/' . \Nf\Registry::get('locale') . '/' . $path . '/'; - - $configDirectory = realpath(\Nf\Registry::get('applicationPath')) . '/configs/' . \Nf\Registry::get('version') . '/' . \Nf\Registry::get('locale') . '/' . $path . '/'; - - $pluginsDirectories = array( - realpath(\Nf\Registry::get('applicationPath') . '/plugins/'), - realpath(\Nf\Registry::get('libraryPath') . '/php/plugins/'), - realpath(\Nf\Registry::get('libraryPath') . '/php/classes/Smarty/plugins/') - ); - - \Nf\File::mkdir($cacheDirectory, 0755, true); - \Nf\File::mkdir($compileDirectory, 0755, true); - - $this->_smarty->setUseSubDirs(true); - - // répertoire de cache de smarty - $this->_smarty->setCacheDir($cacheDirectory); - // répertoire de compilation - $this->_smarty->setCompileDir($compileDirectory); - // répertoire des configs smarty des applis - $this->_smarty->setConfigDir($configDirectory); - // répertoire des plugins - foreach ($pluginsDirectories as $pluginsDirectory) { - $this->_smarty->addPluginsDir($pluginsDirectory); - } - - $this->_smarty->left_delimiter = $config->view->smarty->leftDelimiter; - $this->_smarty->right_delimiter = $config->view->smarty->rightDelimiter; - - // dev : we disable Smarty's caching - if (\Nf\Registry::get('environment') == 'dev') { - $this->_smarty->caching = false; - $this->_smarty->force_compile = true; - $this->_smarty->setCompileCheck(true); - } - - // only one file generated for each rendering - $this->_smarty->merge_compiled_includes = true; - - // send the registry to the view - $this->_smarty->assign('_registry', \Nf\Registry::getInstance()); - - // send the label Manager to the view - $this->_smarty->assign('_labels', \Nf\LabelManager::getInstance()); - - // $this->_smarty->testInstall(); - } -} - - -namespace Nf\Db; - -class Expression -{ - - protected $_expression; - - public function __construct($expression) - { - $this->_expression = (string) $expression; - } - - public function __toString() - { - return $this->_expression; - } -} - - - -namespace Nf\Cache; - -use \Nf\Cache; - -class Memcached implements CacheInterface -{ - - private $_memcache; - - function __construct($params) - { - $this->_memcache = new \Memcache; - if (strpos($params->hosts, ',')>0) { - $hosts=explode(',', $params->hosts); - foreach ($hosts as $host) { - $this->_memcache->addServer($host, $params->port); - } - unset($host); - } else { - $this->_memcache->addServer($params->hosts, $params->port); - } - } - - public function load($keyName, $keyValues = array()) - { - if (Cache::isCacheEnabled()) { - return $this->_memcache->get(Cache::getKeyName($keyName, $keyValues)); - } else { - return false; - } - } - - public function save($keyName, $keyValues, $data, $lifetime = Cache::DEFAULT_LIFETIME) - { - if (Cache::isCacheEnabled()) { - $result = $this->_memcache->set(Cache::getKeyName($keyName, $keyValues), $data, false, $lifetime); - return $result; - } else { - return true; - } - } - - public function delete($keyName, $keyValues) - { - if (Cache::isCacheEnabled()) { - $this->_memcache->delete(Cache::getKeyName($keyName, $keyValues), 0); - return true; - } else { - return true; - } - } -} - - -namespace Nf\Cache; - -interface CacheInterface -{ - - public function load($keyName, $keyValues = array()); - - public function save($keyName, $keyValues, $data, $lifetime = Cache::DEFAULT_LIFETIME); - - public function delete($keyName, $keyValues); -} - - - -namespace Nf\Cache; - -use \Nf\Cache; - -class Apc implements CacheInterface -{ - - function __construct($params) - { - - } - - public function load($keyName, $keyValues = array()) - { - if (Cache::isCacheEnabled()) { - return apc_fetch(Cache::getKeyName($keyName, $keyValues)); - } else { - return false; - } - } - - public function save($keyName, $keyValues, $data, $lifetime = Cache::DEFAULT_LIFETIME) - { - if (Cache::isCacheEnabled()) { - return apc_store(Cache::getKeyName($keyName, $keyValues), $data, $lifetime); - } else { - return true; - } - } - - public function delete($keyName, $keyValues) - { - if (Cache::isCacheEnabled()) { - return apc_delete(Cache::getKeyName($keyName, $keyValues)); - } else { - return true; - } - } -} - - - -namespace Nf\View; - -use Nf\View; -use Nf\Front; -use Nf\Registry; -use Nf\Ini; - -class Php extends View -{ - - protected static $_instance; - - const FILE_EXTENSION='.php'; - - private $_vars=array(); - - private $_templateDirectory=null; - private $_configDirectory=null; - - protected $_response; - - protected function __construct() - { - parent::__construct(); - $front=Front::getInstance(); - $this->setBasePath($front->getModuleName()); - // send the label Manager to the view - $this->_vars['labels'] = \Nf\LabelManager::getInstance(); - } - - /** - * Assign a variable to the view - * - * @param string $key The variable name. - * @param mixed $val The variable value. - * @return void - */ - public function __set($key, $val) - { - $this->_vars[$key]=$val; - return; - } - - public function __get($key) - { - return $this->_vars[$key]; - } - - /** - * Allows testing with empty() and - * isset() to work - * - * @param string $key - * @return boolean - */ - public function __isset($key) - { - return isset($this->_vars[$key]); - } - - /** - * Allows unset() on object properties to work - * - * @param string $key - * @return void - */ - public function __unset($key) - { - unset($this->_vars[$key]); - } - - /** - * Clear all assigned variables - * - * Clears all variables assigned to - * Zend_View either via {@link assign()} or - * property overloading ({@link __get()}/{@link __set()}). - * - * @return void - */ - public function clearVars() - { - $this->_vars=array(); - } - - /** - * Processes a view script and returns the output. - * - * @param string $name The script script name to process. - * @return string The script output. - */ - public function render($name) - { - $this->_response->addBodyPart($this->fetch($name)); - } - - public function fetch($name) - { - // ob_start, require du tpl, ob_get_contents et return - extract($this->_vars); - ob_start(); - include($this->_templateDirectory . $name . self::FILE_EXTENSION); - $content=ob_get_contents(); - ob_end_clean(); - return $content; - } - - - public function setBasePath($path) - { - $this->_templateDirectory = Registry::get('applicationPath') . '/application/' . Registry::get('version') . '/' . $path . '/views/'; - $this->_configDirectory = Registry::get('applicationPath') . '/configs/' . Registry::get('version') . '/' . Registry::get('locale') . '/' . $path . '/'; - } - - public function configLoad($filepath, $section = null) - { - // lire le fichier ini, ajouter aux variables - $ini = Ini::parse($filepath); - foreach ($ini as $key => $value) { - $this->_vars[$key]=$value; - } - - } -} - - -namespace Nf\Task; - -class Manager -{ - - protected $pool; - - function __construct() - { - $this->pool = array(); - } - - function addTask($task, $callbackFunction = null) - { - $this->pool[] = array( - 'task' => $task, - 'callback' => $callbackFunction - ); - } - - function run() - { - foreach ($this->pool as $taskInfos) { - $taskInfos['task']->fork(); - } - - while (1) { - // echo "waiting\n"; - $pid = pcntl_wait($extra); - if ($pid == - 1) { - break; - } - // echo ": task done : $pid\n"; - $this->finishTask($pid); - } - // echo "processes done ; exiting\n"; - return; - } - - function finishTask($pid) - { - $taskInfos = $this->pidToTaskInfos($pid); - if ($taskInfos) { - $taskInfos['task']->finish(); - $taskInfos['callback'](); - } - } - - function pidToTaskInfos($pid) - { - foreach ($this->pool as $taskInfos) { - if ($taskInfos['task']->pid() == $pid) - return $taskInfos; - } - return false; - } -} - -namespace Nf\Profiler; - -use \Nf\Registry; -use \Nf\Middleware\Post; - -class Firephp extends ProfilerAbstract -{ - - use Post; - - protected $totalDuration = 0; - - protected $firephp = false; - - protected $dbName = ''; - - public function output() - { - } - - public function __construct($config) - { - - require_once(realpath(Registry::get('libraryPath') . '/php/classes/FirePHPCore/FirePHP.class.php')); - $this->firephp = \FirePHP::getInstance(true); - - $this->label = static::LABEL_TEMPLATE; - - $front = \Nf\Front::getInstance(); - - $this->dbName = $config['name']; - - $front->registerMiddleware($this); - - $this->payload = array( - array( - 'Duration', - 'Query', - 'Time' - ) - ); - } -} - - -namespace Nf\Profiler; - -use \Nf\Registry; - -class ProfilerAbstract -{ - - protected $label = array(); - protected $payload = array(); -} - - -namespace Nf\Error; - -class Handler extends \Exception -{ - - static $lastError = array( - 'type' => 'error', - 'httpCode' => 0, - 'message' => '', - 'number' => 0, - 'file' => '', - 'line' => 0, - 'trace' => '' - ); - - public static function getLastError() - { - return self::$lastError; - } - - public static function disableErrorHandler() - { - while (set_error_handler(create_function('$errno,$errstr', 'return false;'))) { - // Unset the error handler we just set. - restore_error_handler(); - // Unset the previous error handler. - restore_error_handler(); - } - // Restore the built-in error handler. - restore_error_handler(); - - while (set_exception_handler(create_function('$e', 'return false;'))) { - // Unset the error handler we just set. - restore_exception_handler(); - // Unset the previous error handler. - restore_exception_handler(); - } - // Restore the built-in error handler. - restore_exception_handler(); - } - - public static function handleError($errno = null, $errstr = 0, $errfile = null, $errline = null) - { - $error_reporting = error_reporting(); - if ($error_reporting == 0) { - return true; // developer used @ to ignore all errors - } - if (! ($error_reporting & $errno)) { - return true; // developer asked to ignore this error - } - throw new \ErrorException($errstr, 0, $errno, $errfile, $errline); - return false; - } - - public static function handleException($exception) - { - self::$lastError['httpCode'] = 500; - self::$lastError['message'] = $exception->getMessage(); - - if (method_exists($exception, 'getHttpStatus')) { - self::$lastError['httpCode'] = $exception->getHttpStatus(); - } - - if (method_exists($exception, 'getErrors')) { - self::$lastError['message'] = $exception->getErrors(); - } - - self::disableErrorHandler(); - self::$lastError['type'] = 'exception'; - self::$lastError['fullException'] = $exception; - self::$lastError['number'] = 0; - self::$lastError['file'] = $exception->getFile(); - self::$lastError['line'] = $exception->getLine(); - self::$lastError['trace'] = $exception->getTraceAsString(); - - return self::displayAndLogError($exception); - } - - public static function handleFatal() - { - self::disableErrorHandler(); - $last = error_get_last(); - if ($last != null) { - self::$lastError['type'] = 'fatal'; - self::$lastError['httpCode'] = 500; - self::$lastError['message'] = $last['message']; - self::$lastError['number'] = $last['type']; - self::$lastError['file'] = $last['file']; - self::$lastError['line'] = $last['line']; - self::$lastError['trace'] = ''; - return self::displayAndLogError(); - } - } - - public static function handleForbidden($httpCode = 403, $friendlyMessage = '') - { - return self::handleHttpError('forbidden', $httpCode, $friendlyMessage); - } - - public static function handleNotFound($httpCode = 404, $friendlyMessage = '') - { - return self::handleHttpError('notFound', $httpCode, $friendlyMessage); - } - - private static function handleHttpError($type = 'notFound', $httpCode, $friendlyMessage = '') - { - self::$lastError['type'] = $type; - self::$lastError['httpCode'] = $httpCode; - self::$lastError['message'] = $friendlyMessage; - self::$lastError['number'] = 0; - self::$lastError['file'] = ''; - self::$lastError['line'] = 0; - self::$lastError['trace'] = ''; - - if (\Nf\Registry::isRegistered('config')) { - $config = \Nf\Registry::get('config'); - $front = \Nf\Front::getInstance(); - $response = $front->getResponse(); - if ((isset($config->error->clearResponse) && $config->error->clearResponse) || (! isset($config->error->clearResponse))) { - $response->clearBody(); - $response->clearBuffer(); - } - try { - $response->setHttpResponseCode($httpCode); - $response->sendHeaders(); - } catch (Exception $e) {} - - $configName = strtolower($type); - - if (isset($config->error->displayMethod)) { - if ($config->error->displayMethod == 'forward') { - // forward - if (! $front->forward($config->$configName->forward->module, $config->$configName->forward->controller, $config->$configName->forward->action)) { - ini_set('display_errors', 'On'); - trigger_error('Error Handler failed to forward to the error controller.', E_USER_ERROR); - } - return true; - } else { - $response->addBodyPart('http error: ' . $httpCode); - } - } - } - } - - public static function displayAndLogError($exception = null) - { - $err = self::getLastError(); - - if (\Nf\Registry::isRegistered('config')) { - $config = \Nf\Registry::get('config'); - $front = \Nf\Front::getInstance(); - $response = $front->getResponse(); - - // optional error logging - if ((isset($exception->doLog) && $exception->doLog || ! isset($exception->doLog))) { - if (isset($config->error->logger->class) && strtolower($config->error->logger->class) != 'syslog') { - $className = $config->error->logger->class; - $logger = new $className(); - if (! $logger->log($err)) {} - } else { - $logger = new \Nf\Error\Logger\Syslog(); - if (! $logger->log($err)) {} - } - } - - if ($response->isBinary()) { - $response->setContentType('html'); - } - if ((isset($config->error->clearResponse) && $config->error->clearResponse) || (! isset($config->error->clearResponse))) { - $response->clearBody(); - $response->clearBuffer(); - } - try { - $response->setHttpResponseCode($err['httpCode']); - $response->sendHeaders(); - } catch (Exception $e) {} - - if (isset($config->error->displayMethod)) { - if ($config->error->displayMethod == 'forward') { - // forward - if (! $front->forward($config->error->forward->module, $config->error->forward->controller, $config->error->forward->action)) { - echo '** Nf: Cannot instantiate error module, printing error message **' . PHP_EOL . PHP_EOL; - $response->displayError($err); - echo PHP_EOL; - } else { - $response->sendResponse(); - } - return true; - } else { - if (method_exists($exception, 'display')) { - $response->setHttpResponseCode($err['httpCode']); - $exception->display(); - } else { - // default : display (if xhr, use alternative display) - $response->displayError($err, $front->getRequest() - ->isXhr()); - } - } - } - - return true; - } else { - @header('HTTP/1.1 500 Internal Server Error'); - print_r($err); - error_log(print_r($err, true)); - return true; - } - } - - public static function setErrorHandler() - { - set_error_handler(array( - 'Nf\Error\Handler', - 'handleError' - )); - set_exception_handler(array( - 'Nf\Error\Handler', - 'handleException' - )); - register_shutdown_function(array( - 'Nf\Error\Handler', - 'handleFatal' - )); - } - - public static function setErrorDisplaying() - { - if (\Nf\Registry::isRegistered('config')) { - $config = \Nf\Registry::get('config'); - if (isset($config->error->displayPHPErrors) && (strtolower($config->error->displayPHPErrors) == 'off' || $config->error->displayPHPErrors == 0)) { - ini_set('display_errors', 0); // don't display the errors - } else { - ini_set('display_errors', 1); // display the errors - } - } else { - ini_set('display_errors', 1); - } - } - - public static function recursiveArrayToString($arr) - { - if (! is_string($arr)) { - return json_encode($arr); - } else { - return $arr; - } - } -} - - - -namespace Nf\Session; - -use Nf\Session; -use Nf\Db; -use Nf\Date; - -class Mysqli extends Session -{ - protected static $_instance=null; - - private $_lifeTime; - private $_connection; - private $_params; - - function __construct($params, $lifetime) - { - register_shutdown_function('session_write_close'); - $db = Db::getConnection($params->db_adapter); - $this->_params=$params; - $this->_connection=$db; - $this->_lifeTime = $lifetime; - } - - function open($savePath, $sessionName) - { - - } - - function close() - { - $this->_connection->closeConnection(); - return true; - } - - function read($sessionId) - { - if ($sessionId !== '') { - $sql="SELECT data FROM " . $this->_params->db_table . " WHERE id=" . $this->_connection->quote($sessionId) . " LIMIT 1"; - $res=$this->_connection->query($sql); - if ($res->rowCount()>0) { - $row=$res->fetch(); - return $row['data']; - } - } - } - - function write($sessionId, $data) - { - // This is called upon script termination or when session_write_close() is called, which ever is first. - $values=array( - 'data' => $data, - 'id' => $sessionId, - 'modified' => date('Y-m-d H:i:s'), - 'lifetime' => $this->_lifeTime - ); - $sql="INSERT INTO " . $this->_params->db_table . " (id, data, modified, lifetime) VALUES(" . $this->_connection->quote($values['id']) . ", " . $this->_connection->quote($values['data']) . ", " . $this->_connection->quote($values['modified']) . ", " . $this->_connection->quote($values['lifetime']) . ") - ON DUPLICATE KEY UPDATE data=" . $this->_connection->quote($values['data']) . ", modified=" . $this->_connection->quote($values['modified']); - $this->_connection->query($sql); - return true; - } - - function destroy($sessionId) - { - $sql="DELETE FROM " . $this->_params->db_table . " WHERE id=" . $sessionId; - $this->_connection->query($sql); - return true; - } - - function gc() - { - $sql="DELETE FROM " . $this->_params->db_table . " WHERE modified < DATE_SUB('" . date('Y-m-d H:i:s') . "',INTERVAL lifetime SECOND)"; - $this->_connection->query($sql); - return true; - } -} - - - -namespace Nf\Front; - -class Controller -{ - - protected $_front; - protected $_view; - - public function __construct($front) - { - $this->_front=$front; - } - - public function getParams() - { - return $this->_front->getParams(); - } - - public function __get($var) - { - if ($var=='view') { - if (is_null($this->_view)) { - $this->_view=$this->_front->getView(); - } - return $this->_view; - } elseif ($var=='front') { - return $this->_front; - } elseif ($var=='session') { - return $this->_front->getSession(); - } elseif ($var=='request') { - return $this->_front->getRequest(); - } elseif ($var=='response') { - return $this->_front->getResponse(); - } else { - return $this->$var; - } - } - - public function getRequest() - { - return $this->_front->getRequest(); - } - - public function getResponse() - { - return $this->_front->getResponse(); - } - - // called after dispatch - public function init() - { - return true; - } - - // called after action - public function postAction() - { - - } - - public function getLabel($lbl) - { - return \Nf\LabelManager::get($lbl); - } -} - - -namespace Nf\Front\Request; - -class Http extends AbstractRequest -{ - - protected $_params = array(); - - private $_put = null; - - public function __construct() - { - if (! empty($_SERVER['REDIRECT_URL'])) { - $uri = ltrim($_SERVER['REDIRECT_URL'], '/'); - if (! empty($_SERVER['REDIRECT_QUERY_STRING'])) { - $uri .= '?' . $_SERVER['REDIRECT_QUERY_STRING']; - } - } else { - $uri = ltrim($_SERVER['REQUEST_URI'], '/'); - } - $this->_uri = $uri; - } - - public function sanitizeUri() - { - // filter the uri according to the config of security.restrictCharactersInUrl - // this option only allows us to use Alpha-numeric text, Tilde: ~, Period: ., Colon: :, Underscore: _, Dash: - - $config = \Nf\Registry::get('config'); - if (isset($config->security->restrictCharactersInUrl) && $config->security->restrictCharactersInUrl) { - if (preg_match('%[\w0-9~.,/@\-=:[\]{}|&?!\%]*%i', $this->_uri, $regs)) { - if ($this->_uri == $regs[0]) { - return true; - } - } - return false; - } else { - return true; - } - } - - public function getMethod() - { - return $_SERVER['REQUEST_METHOD']; - } - - public function isPost() - { - if ('POST' == $this->getMethod()) { - return true; - } - return false; - } - - public function isGet() - { - if ('GET' == $this->getMethod()) { - return true; - } - return false; - } - - public function isXhr() - { - return (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest'); - } - - public function getUri() - { - return $this->_uri; - } - - public function getParams() - { - $return = $this->_params; - $paramSources = $this->getParamSources(); - if (in_array('_GET', $paramSources) && isset($_GET) && is_array($_GET)) { - $return += $_GET; - } - if (in_array('_POST', $paramSources) && isset($_POST) && is_array($_POST)) { - $return += $_POST; - } - return $return; - } - - // get the string sent as put - public function setPutFromRequest() - { - if ($this->_put === null) { - if ($_SERVER['REQUEST_METHOD'] == 'PUT') { - $this->_put = file_get_contents("php://input"); - } - } else { - $this->_put = ''; - } - } - - public function getPost($jsonDecode = 'assoc') - { - $post = ''; - if ($_SERVER['REQUEST_METHOD'] == 'POST') { - $post = file_get_contents("php://input"); - } - - if ($jsonDecode == 'assoc') { - return json_decode($post, true); - } else { - return $post; - } - } - - public function getPut($jsonDecode = 'assoc') - { - if ($jsonDecode == 'assoc') { - return json_decode($this->_put, true); - } else { - return $this->_put; - } - } - - // handle the redirection according to the trailing slash configuration - public function redirectForTrailingSlash() - { - $config = \Nf\Registry::get('config'); - $redirectionUrl = false; - $requestParams = ''; - $requestPage = '/' . $this->_uri; - - // we don't redirect for the home page... - if ($requestPage != '/' && mb_strpos($requestPage, '/?') !== 0) { - // the url without the params is : - if (mb_strpos($requestPage, '?') !== false) { - $requestParams = mb_substr($requestPage, mb_strpos($requestPage, '?'), mb_strlen($requestPage) - mb_strpos($requestPage, '?')); - $requestPage = mb_substr($requestPage, 0, mb_strpos($requestPage, '?')); - } - - if (isset($config->trailingSlash->needed) && $config->trailingSlash->needed==true) { - if (mb_substr($requestPage, - 1, 1) != '/') { - $redirectionUrl = 'http://' . $_SERVER['HTTP_HOST'] . $requestPage . '/' . $requestParams; - } - } else { - if (mb_substr($requestPage, - 1, 1) == '/') { - $redirectionUrl = 'http://' . $_SERVER['HTTP_HOST'] . rtrim($requestPage, '/') . $requestParams; - } - } - - if ($redirectionUrl !== false) { - $response = new \Nf\Front\Response\Http(); - $response->redirect($redirectionUrl, 301); - $response->sendHeaders(); - return true; - } - } - - return false; - } -} - - -namespace Nf\Front\Response; - -class Http extends AbstractResponse -{ - - const SEPARATOR = 'separator'; - - const SEPARATOR_ALT = "\n"; - - const NEWLINE = '
'; - - const NEWLINE_ALT = "\n"; - - const TAB = " "; - - const TAB_ALT = " "; - - private $contentType = 'html'; - - private $isBinaryContent = false; - - private $encoding = 'utf-8'; - - protected $_headers = array(); - - protected $_headersRaw = array(); - - protected $_httpResponseCode = 200; - - protected $_isRedirect = false; - - protected function _normalizeHeader($name) - { - $filtered = str_replace(array( - '-', - '_' - ), ' ', (string) $name); - $filtered = ucwords(strtolower($filtered)); - $filtered = str_replace(' ', '-', $filtered); - return $filtered; - } - - public function setHeader($name, $value, $replace = false) - { - $this->canSendHeaders(true); - $name = $this->_normalizeHeader($name); - $value = (string) $value; - - if ($replace) { - foreach ($this->_headers as $key => $header) { - if ($name == $header['name']) { - unset($this->_headers[$key]); - } - } - } - $this->_headers[] = array( - 'name' => $name, - 'value' => $value, - 'replace' => $replace - ); - return $this; - } - - public function redirect($url, $code = 302, $exit = true) - { - $this->canSendHeaders(); - $this->setHeader('Location', $url, true)->setHttpResponseCode($code); - if ($exit) { - $front = \Nf\Front::getInstance(); - $front->postLaunchAction(); - $this->clearBuffer(); - $this->clearBody(); - $this->sendHeaders(); - exit(); - } - return $this; - } - - public function isRedirect() - { - return $this->_isRedirect; - } - - public function getHeaders() - { - return $this->_headers; - } - - public function clearHeaders() - { - $this->_headers = array(); - - return $this; - } - - public function clearHeader($name) - { - if (! count($this->_headers)) { - return $this; - } - foreach ($this->_headers as $index => $header) { - if ($name == $header['name']) { - unset($this->_headers[$index]); - } - } - return $this; - } - - public function setRawHeader($value) - { - $this->canSendHeaders(); - if ('Location' == substr($value, 0, 8)) { - $this->_isRedirect = true; - } - $this->_headersRaw[] = (string) $value; - return $this; - } - - public function clearRawHeaders() - { - $this->_headersRaw = array(); - return $this; - } - - public function clearRawHeader($headerRaw) - { - if (! count($this->_headersRaw)) { - return $this; - } - $key = array_search($headerRaw, $this->_headersRaw); - unset($this->_headersRaw[$key]); - return $this; - } - - public function clearAllHeaders() - { - return $this->clearHeaders()->clearRawHeaders(); - } - - public function setHttpResponseCode($code) - { - if (! is_int($code) || (100 > $code) || (599 < $code)) { - throw new \Exception('Invalid HTTP response code'); - } - if ((300 <= $code) && (307 >= $code)) { - $this->_isRedirect = true; - } else { - $this->_isRedirect = false; - } - $this->_httpResponseCode = $code; - return $this; - } - - public function canSendHeaders() - { - $headersSent = headers_sent($file, $line); - if ($headersSent) { - trigger_error('Cannot send headers; headers already sent in ' . $file . ', line ' . $line); - } - return ! $headersSent; - } - - public function sendHeaders() - { - // Only check if we can send headers if we have headers to send - if (count($this->_headersRaw) || count($this->_headers) || (200 != $this->_httpResponseCode)) { - $this->canSendHeaders(); - } elseif (200 == $this->_httpResponseCode) { - // Haven't changed the response code, and we have no headers - return $this; - } - - $httpCodeSent = false; - - foreach ($this->_headersRaw as $header) { - if (! $httpCodeSent && $this->_httpResponseCode) { - header($header, true, $this->_httpResponseCode); - $httpCodeSent = true; - } else { - header($header); - } - } - - foreach ($this->_headers as $header) { - if (! $httpCodeSent && $this->_httpResponseCode) { - header($header['name'] . ': ' . $header['value'], $header['replace'], $this->_httpResponseCode); - $httpCodeSent = true; - } else { - header($header['name'] . ': ' . $header['value'], $header['replace']); - } - } - - if (! $httpCodeSent) { - header('HTTP/1.1 ' . $this->_httpResponseCode); - $httpCodeSent = true; - } - - return $this; - } - - public function displayError($err, $isXhr = false) - { - // removes the cache headers if there is an error - $this->setCacheable(0); - if ($isXhr || $this->contentType!='html') { - $this->setContentType('text'); - echo 'Error' . self::NEWLINE_ALT; - echo strip_tags(self::displayErrorHelper($err, true)); - echo 'Error' . self::NEWLINE_ALT; - } else { - echo '
Error
'; - echo self::displayErrorHelper($err, false); - echo '
'; - } - } - - protected static function boldText($text, $alternativeSeparator = false) - { - if ($alternativeSeparator) { - return '* ' . $text . ' *'; - } else { - return '' . $text . ''; - } - } - - protected static function preFormatErrorText($beginOrEnd, $alternativeSeparator) - { - if ($alternativeSeparator) { - return ($beginOrEnd == 0) ? '' : ''; - } else { - return ($beginOrEnd == 0) ? '
' : '
'; - } - } - - // sends header to allow the browser to cache the response a given time - public function setCacheable($minutes) - { - $this->setHeader('Expires', gmdate('D, d M Y H:i:s', time() + $minutes * 60) . ' GMT', true); - $this->setHeader('Cache-Control', 'max-age=' . $minutes * 60, true); - $this->setHeader('Pragma', 'public', true); - } - - public function getContentType() - { - return $this->contentType; - } - - public function isBinary() - { - return $this->isBinaryContent; - } - - public function setContentType($type = 'html') - { - $this->contentType = $type; - $this->isBinaryContent = false; - $type = strtolower($type); - switch ($type) { - case 'atom': - $this->setHeader('content-type', 'application/atom+xml'); - break; - case 'css': - $this->setHeader('content-type', 'text/css'); - break; - case 'gif': - $this->setHeader('content-type', 'image/gif'); - $this->isBinaryContent = true; - break; - case 'jpeg': - case 'jpg': - $this->setHeader('content-type', 'image/jpeg'); - $this->isBinaryContent = true; - break; - case 'png': - $this->setHeader('content-type', 'image/png'); - $this->isBinaryContent = true; - break; - case 'js': - case 'javascript': - $this->setHeader('content-type', 'text/javascript'); - break; - case 'json': - $this->setHeader('content-type', 'application/json'); - break; - case 'pdf': - $this->setHeader('content-type', 'application/pdf'); - $this->isBinaryContent = true; - break; - case 'rss': - $this->setHeader('content-type', 'application/rss+xml'); - break; - case 'text': - $this->setHeader('content-type', 'text/plain'); - break; - case 'xml': - $this->setHeader('content-type', 'text/xml'); - break; - case 'html': - $this->setHeader('content-type', 'text/html'); - break; - default: - throw new \Exception('This content type was not found: "' . $type . '"'); - } - } - - public function getEncoding() - { - return $this->encoding; - } - - public function setEncoding($encoding) - { - $this->encoding = $encoding; - } - - public static function colorText($text, $color, $alternativeSeparator = false) - { - if(!$alternativeSeparator) { - return '' . $text . ''; - } - else { - return $text; - } - } - - protected static function escape($str) - { - return strip_tags($str); - } -} - - -namespace Nf\Db\Adapter; - -abstract class AbstractAdapter -{ - - const PROFILER_NAMESPACE_ROOT = '\Nf\Db\Profiler'; - - protected $_config = array(); - - protected $_connection = null; - - protected $_autoQuoteIdentifiers = true; - - protected $_cache = false; - - protected $profiler = false; - - public function __construct($config) - { - if (! is_array($config)) { - throw new \Exception('Adapter parameters must be in an array'); - } - if (! isset($config['charset'])) { - $config['charset'] = null; - } - $this->_config = $config; - } - - public function getConnection() - { - $this->_connect(); - return $this->_connection; - } - - public function query($sql) - { - $this->_connect(); - $res = new $this->_resourceClass($sql, $this); - - $beginTime = microtime(true); - - $res->execute(); - - $endTime = microtime(true); - - if ($this->profiler) { - $this->profiler->afterQuery($res, $sql, $endTime-$beginTime); - } - - return $res; - } - - public function fetchAll($sql) - { - $cacheKey = md5($sql) . 'All'; - - if (($result = $this->_getCachedResult($cacheKey)) === false) { - $stmt = $this->query($sql); - $result = $stmt->fetchAll(\Nf\Db::FETCH_ASSOC); - $this->_setCachedResult($cacheKey, $result); - } - $this->disableCache(); - return $result; - } - - public function fetchAssoc($sql) - { - $cacheKey = md5($sql) . 'Assoc'; - - if (($result = $this->_getCachedResult($cacheKey)) === false) { - $stmt = $this->query($sql); - $result = array(); - while ($row = $stmt->fetch(\Nf\Db::FETCH_ASSOC)) { - $tmp = array_values(array_slice($row, 0, 1)); - $result[$tmp[0]] = $row; - } - $this->_setCachedResult($cacheKey, $result); - } - $this->disableCache(); - return $result; - } - - public function fetchRow($sql) - { - $cacheKey = md5($sql) . 'Row'; - - if (($result = $this->_getCachedResult($cacheKey)) === false) { - $stmt = $this->query($sql); - $result = $stmt->fetch(); - $this->_setCachedResult($cacheKey, $result); - } - $this->disableCache(); - return $result; - } - - public function fetchCol($sql) - { - $cacheKey = md5($sql) . 'Col'; - - if (($result = $this->_getCachedResult($cacheKey)) === false) { - $stmt = $this->query($sql); - $result = $stmt->fetchAll(\Nf\Db::FETCH_COLUMN, 0); - $this->_setCachedResult($cacheKey, $result); - } - $this->disableCache(); - return $result; - } - - public function fetchOne($sql) - { - $cacheKey = md5($sql) . 'One'; - - if (($result = $this->_getCachedResult($cacheKey)) === false) { - $stmt = $this->query($sql); - $result = $stmt->fetchColumn(0); - $this->_setCachedResult($cacheKey, $result); - } - $this->disableCache(); - return $result; - } - - public function fetchPairs($sql) - { - $cacheKey = md5($sql) . 'Pairs'; - - if (($result = $this->_getCachedResult($cacheKey)) === false) { - $stmt = $this->query($sql); - $result = array(); - while ($row = $stmt->fetch(\Nf\Db::FETCH_NUM)) { - $result[$row[0]] = $row[1]; - } - $this->_setCachedResult($cacheKey, $result); - } - $this->disableCache(); - return $result; - } - - public function beginTransaction() - { - $this->_beginTransaction(); - return $this; - } - - public function commit() - { - $this->_commit(); - return $this; - } - - public function rollback() - { - $this->_rollback(); - return $this; - } - - public function enableCache($lifetime = \Nf\Cache::DEFAULT_LIFETIME, $cacheKey = null) - { - $this->_cache = array( - 'lifetime' => $lifetime - ); - if ($cacheKey !== null) { - $this->_cache['key'] = $cacheKey; - } - return $this; - } - - public function disableCache() - { - $this->_cache = false; - return $this; - } - - protected function _getCachedResult($cacheKey) - { - if ($this->_cache !== false) { - $cache = \Nf\Front::getInstance()->getCache('global'); - $cacheKey = isset($this->_cache['key']) ? $this->_cache['key'] : $cacheKey; - return $cache->load('sql', $cacheKey); - } - return false; - } - - protected function _setCachedResult($cacheKey, $result) - { - if ($this->_cache !== false) { - $cache = \Nf\Front::getInstance()->getCache('global'); - $cacheKey = isset($this->_cache['key']) ? $this->_cache['key'] : $cacheKey; - return $cache->save('sql', $cacheKey, $result, $this->_cache['lifetime']); - } - return false; - } - - protected function _quote($value) - { - if (null === $value) { - return 'NULL'; - } elseif (is_int($value) || $value instanceof \Nf\Db\Expression) { - return $value; - } elseif (is_float($value)) { - return sprintf('%F', $value); - } else { - return "'" . addcslashes($value, "\000\n\r\\'\"\032") . "'"; - } - } - - public function quote($value, $type = null) - { - $this->_connect(); - return $this->_quote($value); - } - - public function quoteIdentifier($ident, $auto = false) - { - return $this->_quoteIdentifierAs($ident, null, $auto); - } - - public function quoteColumnAs($ident, $alias, $auto = false) - { - return $this->_quoteIdentifierAs($ident, $alias, $auto); - } - - protected function _quoteIdentifierAs($ident, $alias = null, $auto = false, $as = ' AS ') - { - if (is_string($ident)) { - $ident = explode('.', $ident); - } - if (is_array($ident)) { - $segments = array(); - foreach ($ident as $segment) { - $segments[] = $this->_quoteIdentifier($segment, $auto); - } - if ($alias !== null && end($ident) == $alias) { - $alias = null; - } - $quoted = implode('.', $segments); - } else { - $quoted = $this->_quoteIdentifier($ident, $auto); - } - - if ($alias !== null) { - $quoted .= $as . $this->_quoteIdentifier($alias, $auto); - } - return $quoted; - } - - protected function _quoteIdentifier($value, $auto = false) - { - if ($auto === false || $this->_autoQuoteIdentifiers === true) { - $q = $this->getQuoteIdentifierSymbol(); - return ($q . str_replace("$q", "$q$q", $value) . $q); - } - return $value; - } - - public function getQuoteIdentifierSymbol() - { - return '"'; - } - - public function setProfilerConfig($profilerConfig) - { - if ($profilerConfig!=null) { - if (isset($profilerConfig['class'])) { - if (!empty($profilerConfig['class'])) { - $profilerClass = $profilerConfig['class']; - unset($profilerConfig['class']); - $optionalConfig = $profilerConfig; - $profilerFullClassName = self::PROFILER_NAMESPACE_ROOT . '\\' . $profilerClass; - $profilerInstance = new $profilerFullClassName($optionalConfig); - $this->profiler = $profilerInstance; - } - } else { - throw new \Exception('You must set the profiler class name in the config.ini file'); - } - } - } - - abstract protected function _connect(); - - abstract public function isConnected(); - - abstract public function closeConnection(); - - abstract public function lastInsertId($tableName = null, $primaryKey = null); -} - - -namespace Nf\Db\Adapter; - -use Nf\Localization; - -class Mysqli extends AbstractAdapter -{ - - protected $_resourceClass = '\\Nf\\Db\\Resource\\Mysqli'; - - protected function _connect() - { - if ($this->_connection) { - return; - } - - if (! extension_loaded('mysqli')) { - throw new \Exception('The Mysqli extension is required for this adapter but the extension is not loaded'); - } - - if (isset($this->_config['port'])) { - $port = (integer) $this->_config['port']; - } else { - $port = null; - } - - $this->_connection = mysqli_init(); - - if (! empty($this->_config['driver_options'])) { - foreach ($this->_config['driver_options'] as $option => $value) { - if (is_string($option)) { - // Suppress warnings here - // Ignore it if it's not a valid constant - $option = @constant(strtoupper($option)); - if ($option === null) { - continue; - } - } - @mysqli_options($this->_connection, $option, $value); - } - } - - // Suppress connection warnings here. - // Throw an exception instead. - try { - $_isConnected = mysqli_real_connect($this->_connection, $this->_config['hostname'], $this->_config['username'], $this->_config['password'], $this->_config['database'], $port); - } catch (Exception $e) { - $_isConnected = false; - } - - if ($_isConnected === false || mysqli_connect_errno()) { - $this->closeConnection(); - throw new \Exception(mysqli_connect_error()); - } - - if ($_isConnected && ! empty($this->_config['charset'])) { - mysqli_set_charset($this->_connection, $this->_config['charset']); - } - } - - public function isConnected() - { - return ((bool) ($this->_connection instanceof mysqli)); - } - - public function closeConnection() - { - if ($this->isConnected()) { - $this->_connection->close(); - } - $this->_connection = null; - } - - public function getQuoteIdentifierSymbol() - { - return "`"; - } - - protected function _quote($value) - { - if (null === $value) { - return 'NULL'; - } elseif (is_int($value) || is_float($value) || $value instanceof \Nf\Db\Expression) { - return $value; - } - $this->_connect(); - return "'" . $this->_connection->real_escape_string($value) . "'"; - } - - public function lastInsertId($tableName = null, $primaryKey = null) - { - $mysqli = $this->_connection; - return (string) $mysqli->insert_id; - } - - public function insert($tableName, array $bind) - { - $sql = "INSERT INTO " . $this->quoteIdentifier($tableName, true); - if (! count($bind)) { - // allows for inserting a row without values to get an auto increment id - $sql .= " VALUES()"; - } else { - $sql .= " SET "; - $insertFields = array(); - foreach ($bind as $key => $value) { - $insertFields[] = $this->quoteIdentifier($key) . "=" . $this->quote($value); - } - $sql .= " " . implode(', ', $insertFields); - } - - $res = new $this->_resourceClass($sql, $this); - $res->execute(); - - return $this->getConnection()->affected_rows; - } - - public function insertIgnore($tableName, array $bind) - { - $sql = "INSERT IGNORE INTO " . $this->quoteIdentifier($tableName, true) . " SET "; - $updateFields = array(); - foreach ($bind as $key => $value) { - $updateFields[] = $this->quoteIdentifier($key) . "=" . $this->quote($value); - } - $sql .= " " . implode(', ', $updateFields); - - $res = new $this->_resourceClass($sql, $this); - $res->execute(); - - return $this->getConnection()->affected_rows; - } - - public function upsert($tableName, array $bind, array $where) - { - $sql = "INSERT INTO " . $this->quoteIdentifier($tableName, true) . " SET "; - $updateFields = array(); - foreach ($bind as $key => $value) { - $updateFields[] = $this->quoteIdentifier($key) . "=" . $this->quote($value); - } - foreach ($where as $key => $value) { - $updateFields[] = $this->quoteIdentifier($key) . "=" . $this->quote($value); - } - $sql .= " " . implode(', ', $updateFields); - - $sqlOnDuplicate = " ON DUPLICATE KEY UPDATE "; - $onDuplicateFields = array(); - foreach ($bind as $key => $value) { - $onDuplicateFields[] = $this->quoteIdentifier($key) . "=" . $this->quote($value); - } - $sqlOnDuplicate .= " " . implode(', ', $onDuplicateFields); - - $sql .= $sqlOnDuplicate; - - $res = new $this->_resourceClass($sql, $this); - $res->execute(); - - return $this->getConnection()->affected_rows; - } - - public function update($tableName, array $bind, $where = '') - { - $sql = "UPDATE " . $this->quoteIdentifier($tableName, true) . " SET "; - $updateFields = array(); - foreach ($bind as $key => $value) { - $updateFields[] = $this->quoteIdentifier($key) . "=" . $this->quote($value); - } - $sql .= " " . implode(', ', $updateFields); - if ($where != '') { - $sql .= " WHERE " . $where; - } - - $res = new $this->_resourceClass($sql, $this); - $res->execute(); - - return $this->getConnection()->affected_rows; - } - - public function delete($tableName, $where = '') - { - if ($where != '') { - $sql = "DELETE FROM " . $this->quoteIdentifier($tableName, true) . " WHERE " . $where; - } else { - $sql = "TRUNCATE TABLE" . $this->quoteIdentifier($tableName, true); - } - - $res = new $this->_resourceClass($sql, $this); - $res->execute(); - - return $this->getConnection()->affected_rows; - } - - function cleanConnection() - { - $mysqli = $this->_connect(); - $mysqli = $this->_connection; - - while ($mysqli->more_results()) { - if ($mysqli->next_result()) { - $res = $mysqli->use_result(); - if (is_object($res)) { - $res->free_result(); - } - } - } - } - - public function multiQuery($queries) - { - $mysqli = $this->_connect(); - $mysqli = $this->_connection; - - if (is_array($queries)) { - $queries = implode(';', $queries); - } - - $ret = $mysqli->multi_query($queries); - - if ($ret === false) { - throw new \Exception($mysqli->error); - } - } - - public static function formatDate($inShortFormatDateOrTimestamp, $hasMinutes = false) - { - $tstp = Localization::dateToTimestamp($inShortFormatDateOrTimestamp, Localization::SHORT, ($hasMinutes ? Localization::SHORT : Localization::NONE), true); - if ($hasMinutes) { - return date('Y-m-d', $tstp); - } else { - return date('Y-m-d H:i:s', $tstp); - } - } - - /** - * Begin a transaction. - * - * @return void - */ - protected function _beginTransaction() - { - $this->_connect(); - $this->_connection->autocommit(false); - } - - /** - * Commit a transaction. - * - * @return void - */ - protected function _commit() - { - $this->_connect(); - $this->_connection->commit(); - $this->_connection->autocommit(true); - } - - /** - * Roll-back a transaction. - * - * @return void - */ - protected function _rollBack() - { - $this->_connect(); - $this->_connection->rollback(); - $this->_connection->autocommit(true); - } -} - - -namespace Nf\Db\Profiler; - -class File extends \Nf\Profiler\File -{ - - public function afterQuery($resource, $sql, $duration) - { - fputs($this->handle, date('Y-m-d H:i:s') . PHP_EOL . str_replace(array( - "\n", - "\t" - ), ' ', $sql) . PHP_EOL . round($duration * 10000, 2) . ' ms' . PHP_EOL . '--' . PHP_EOL); - } -} - - -namespace Nf\Error\Exception; - -class ClientException extends \Exception -{ -} - - -namespace Nf\Db\Profiler; - -class Firephp extends \Nf\Profiler\Firephp -{ - - const LABEL_TEMPLATE = '#dbName# (#nbQueries# @ #totalDuration# ms)'; - - public function afterQuery($resource, $sql, $duration) - { - $this->payload[] = array( - '' . round($duration * 10000, 2), - str_replace(array( - "\n", - "\t" - ), ' ', $sql), - date('Y-m-d H:i:s') - ); - - $this->totalDuration += $duration * 10000; - } - - // outputs the payload - public function execute() - { - $this->label = str_replace(array( - '#dbName#', - '#nbQueries#', - '#totalDuration#' - ), array( - $this->dbName, - count($this->payload) - 1, - round($this->totalDuration, 2) - ), $this->label); - - $this->firephp->fb(array( - $this->label, - $this->payload - ), \FirePHP::TABLE); - } -} - - -namespace Nf\Error\Exception; - -class Http extends \Exception -{ - - protected $_httpStatus = 500; - - public $doLog = true; - - public function getHttpStatus() - { - return $this->_httpStatus; - } - - public function display() - { - $front = \Nf\Front::getInstance(); - $response = $front->getResponse(); - $response->sendResponse(); - } -} - - -namespace Nf\Error\Logger; - -use \Nf\Registry; -use \Nf\Error\Handler; - -class Gelf -{ - - public function log($err) - { - $config = Registry::get('config'); - - // We need a transport - UDP via port 12201 is standard. - $transport = new \Gelf\Transport\UdpTransport($config->error->logger->gelf->ip, $config->error->logger->gelf->port, \Gelf\Transport\UdpTransport::CHUNK_SIZE_LAN); - - // While the UDP transport is itself a publisher, we wrap it in a real Publisher for convenience - // A publisher allows for message validation before transmission, and it calso supports to send messages - // to multiple backends at once - $publisher = new \Gelf\Publisher(); - $publisher->addTransport($transport); - - $fullMessage = \Nf\Front\Response\Cli::displayErrorHelper($err); - - // Now we can create custom messages and publish them - $message = new \Gelf\Message(); - $message->setShortMessage(Handler::recursiveArrayToString($err['message'])) - ->setLevel(\Psr\Log\LogLevel::ERROR) - ->setFile($err['file']) - ->setLine($err['line']) - ->setFullMessage($fullMessage); - - if (php_sapi_name() == 'cli') { - global $argv; - $message->setAdditional('url', 'su ' . $_SERVER['LOGNAME'] . ' -c "php ' . Registry::get('applicationPath') . '/html/' . implode(' ', $argv) . '"'); - } else { - $message->setAdditional('url', 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); - } - - if (isset($config->error->logger->additionals)) { - foreach ($config->error->logger->additionals as $additionalName => $additionalValue) { - $message->setAdditional($additionalName, $additionalValue); - } - } - - if ($publisher->publish($message)) { - return true; - } else { - return false; - } - } -} - - -namespace Nf\Front\Response; - -abstract class AbstractResponse -{ - - protected $_bodyParts = array(); - - public function addBodyPart($bodyPart) - { - $this->_bodyParts[] = $bodyPart; - } - - public function clearBody() - { - $this->_bodyParts = array(); - } - - public function clearBuffer() - { - $maxObLevel = \Nf\Front::$obLevel; - $curObLevel = ob_get_level(); - if ($curObLevel > $maxObLevel) { - do { - ob_end_clean(); - $curObLevel = ob_get_level(); - } while ($curObLevel > $maxObLevel); - } - } - - public function output() - { - echo implode('', $this->_bodyParts); - } - - public function sendResponse() - { - $this->sendHeaders(); - $this->output(); - } - - public function setHttpResponseCode($code) - {} - - public function isBinary() - { - return false; - } - - public function getContentType() - { - return false; - } - - public function setContentType($type = 'html') - {} - - public static function displayErrorHelper($err, $alternativeSeparator = false) - { - $output = ''; - - $separator = $alternativeSeparator ? static::NEWLINE_ALT : static::NEWLINE; - - if ($err['type'] != 'fatal') { - $output .= static::colorText($err['type'] . ': ' . \Nf\Error\Handler::recursiveArrayToString(static::escape($err['message'])), 'red'); - $output .= $separator; - $output .= static::colorText($err['file'] . ' (line ' . $err['line'] . ')', 'green', $alternativeSeparator); - $output .= $separator . '-----' . $separator; - $output .= implode($separator, self::getFileSample($err['file'], $err['line'])); - $output .= $separator . '-----' . $separator; - $trace = $err['fullException']->getTrace(); - foreach ($trace as $entry) { - $output .= self::stackTracePrintEntry($entry); - if(isset($entry['file']) && isset($entry['line'])) { - $output .= '-----' . $separator; - $output .= implode($separator, self::getFileSample($entry['file'], $entry['line'], 2)); - $output .= $separator . '-----' . $separator; - } - } - } else { - $output .= $err['message'] . $separator; - $output .= static::preFormatErrorText(0, $alternativeSeparator); - $output .= self::stackTracePrintEntry($err, 2, $alternativeSeparator); - $output .= static::preFormatErrorText(1, $alternativeSeparator); - } - return $output; - } - - protected static function stackTracePrintEntry($entry, $displayArgsType = 1, $alternativeSeparator = false) - { - $output = ''; - - if (isset($entry['file'])) { - $output .= static::colorText($entry['file'] . ' (line ' . $entry['line'] . ')', 'green', $alternativeSeparator); - $output .= ($alternativeSeparator ? static::NEWLINE_ALT : static::NEWLINE); - } - if (isset($entry['class'])) { - if ($entry['class'] != 'Nf\Error\Handler') { - $output .= 'call: ' . $entry['class'] . '::'; - if (isset($entry['function'])) { - $output .= $entry['function']; - $output .= ($alternativeSeparator ? static::NEWLINE_ALT : static::NEWLINE); - } - } - } - - if ($displayArgsType > 0 && isset($entry['args']) && count($entry['args'])) { - $output .= static::stackTracePrintArgs($entry['args'], $alternativeSeparator); - $output .= ($alternativeSeparator ? static::NEWLINE_ALT : static::NEWLINE); - } - return $output; - } - - protected static function stackTracePrintArgs($args, $alternativeSeparator) - { - $output = ''; - $output .= 'arguments: '; - $out = array(); - - if (is_array($args)) { - foreach ($args as $k => $v) { - $forOut = ''; - $forOut = $k . ' = '; - if (is_array($v) || is_object($v)) { - $strV = print_r($v, true); - if (strlen($strV) > 50) { - $strV = substr($strV, 0, 50) . '...'; - } - $forReplace = [ - "\n", - "\r" - ]; - $forOut .= str_replace($forReplace, '', $strV); - } else { - $forOut .= $v; - } - $out[] = $forOut; - } - } - - $output .= static::escape($alternativeSeparator ? static::TAB_ALT : static::TAB . '[ ' . implode(', ', $out) . ' ]'); - return $output; - } - - protected static function getFileSample($filename, $line, $linesAround = 3) - { - $file = new \SplFileObject($filename); - $currentLine = $line - $linesAround - 1; - $sample = []; - while ($currentLine >= 0 && ! $file->eof() && $currentLine < $line + $linesAround) { - $file->seek($currentLine); - $currentText = trim($file->current(), "\n\r"); - if ($currentLine == $line - 1) { - $sample[] = $currentText; - } else { - $sample[] = static::colorText($currentText, 'bold_gray'); - } - - $currentLine ++; - } - return $sample; - } -} - - -namespace Nf\Front\Response; - -class Cli extends AbstractResponse -{ - - const SEPARATOR = "\r\n"; - - const NEWLINE = "\r\n"; - - const TAB = "\t"; - - public function setHeader($name, $value, $replace = false) - { - return true; - } - - public function redirect($url, $code = 302) - { - throw new Exception('cannot redirect in cli version'); - } - - public function clearHeaders() - { - return false; - } - - public function canSendHeaders() - { - return true; - } - - public function sendHeaders() - { - return false; - } - - public function displayError($err, $isXhr = false) - { - echo static::colorText('Error', 'red') . static::NEWLINE; - echo self::displayErrorHelper($err); - } - - protected static function boldText($text) - { - return self::colorText($text, 'green'); - } - - protected static function preFormatErrorText($beginOrEnd) - { - return ''; - } - - public static function colorText($text, $color = 'black') - { - $colors = array( - 'black' => '0;30', - 'dark_gray' => '1;30', - 'red' => '0;31', - 'bold_red' => '1;31', - 'green' => '0;32', - 'bold_green' => '1;32', - 'brown' => '0;33', - 'yellow' => '1;33', - 'blue' => '0;34', - 'bold_blue' => '1;34', - 'purple' => '0;35', - 'bold_purple' => '1;35', - 'cyan' => '0;36', - 'bold_cyan' => '1;36', - 'white' => '1;37', - 'bold_gray' => '0;37' - ); - if (isset($colors[$color])) { - return "\033[" . $colors[$color] . 'm' . $text . "\033[0m"; - } - } - - protected static function escape($str) - { - return $str; - } -} - - -namespace Nf\Front\Request; - -class Cli extends AbstractRequest -{ - - // cli parameters that are already used by the framework - const RESERVED_CLI_PARAMS = 'e,environment,l,locale,a,action,m,make'; - - protected $_params = array(); - - public function __construct($uri) - { - $this->_uri = $uri; - } - - public function getUri() - { - return $this->_uri; - } - - public function isXhr() - { - return false; - } - - // sets additional parameters from the command line from the arguments - public function setAdditionalCliParams() - { - $reservedParams = explode(',', self::RESERVED_CLI_PARAMS); - - $params = []; - - $ac = 1; - while ($ac < (count($_SERVER['argv']))) { - $paramName = substr($_SERVER['argv'][$ac], 1); - if (! in_array($paramName, $reservedParams)) { - $params[$paramName] = $_SERVER['argv'][$ac + 1]; - } - $ac += 2; - } - - foreach ($params as $param => $value) { - $this->setParam($param, $value); - } - } - - public function getParams() - { - $return = $this->_params; - return $return; - } -} - - - -namespace Nf\Front\Request; - -class AbstractRequest -{ - - private $_paramSources=array('_GET', '_POST'); - - public function setParam($name, $value) - { - $this->_params[$name]=$value; - } - - public function getParams() - { - return $this->_params; - } - - protected function getParamSources() - { - return $this->_paramSources; - } -} - - -namespace Nf\Error\Logger; - -use \Nf\Registry; - -class Syslog -{ - - public function log($err) - { - if(!is_string($err['message'])) { - $err['message'] = print_r($err['message'], true); - } - syslog(LOG_WARNING, 'error in file: ' . $err['file'] . ' (line ' . $err['line'] . '). ' . $err['message']); - } -} - - -namespace Nf\Db\Resource; - -class Mysqli -{ - - private $_sql; - - private $_res; - - private $_adapter; - - public function __construct($sql, $adapter) - { - $this->_sql = $sql; - $this->_adapter = $adapter; - } - - public function execute() - { - $this->_res = $this->_adapter->getConnection()->query($this->_sql); - if ($this->_res === false) { - throw new \Exception('The query you tried to execute raised an exception: ' . $this->_sql . ' - ' . $this->_adapter->getConnection()->error); - } - } - - public function fetch($mode = null) - { - if (! $this->_res) { - return false; - } - - switch ($mode) { - case \Nf\Db::FETCH_NUM: - return $this->_res->fetch_row(); - break; - case \Nf\Db::FETCH_OBJ: - return $this->_res->fetch_object(); - break; - default: - return $this->_res->fetch_assoc(); - } - } - - public function fetchAll() - { - $data = array(); - while ($row = $this->fetch()) { - $data[] = $row; - } - return $data; - } - - public function fetchColumn($col = 0) - { - $data = array(); - $col = (int) $col; - $row = $this->fetch(\Nf\Db::FETCH_NUM); - if (! is_array($row)) { - return false; - } - return $row[$col]; - } - - public function rowCount() - { - if (! $this->_adapter) { - return false; - } - $mysqli = $this->_adapter->getConnection(); - return $mysqli->affected_rows; - } -} - - -namespace Nf\Error\Exception\Http; - -use Nf\Error\Exception\Http; - -class NotFound extends Http -{ - - public $doLog = false; - - protected $_httpStatus = 404; - - public function getErrors() - { - return ''; - } -} - - -namespace Nf\Error\Exception\Http; - -use Nf\Error\Exception\Http; - -class Unauthorized extends Http -{ - - public $doLog = false; - - protected $_httpStatus = 401; - - public function getErrors() - { - return ''; - } -} - - -namespace Nf\Error\Exception\Http; - -use Nf\Error\Exception\Http; - -class NoContent extends Http -{ - public $doLog = false; - - protected $_httpStatus = 204; - - public function getErrors() - { - return ''; - } -} - - -namespace Nf\Error\Exception\Http; - -use Nf\Error\Exception\Http; - -class Forbidden extends Http -{ - - public $doLog = false; - - protected $_httpStatus = 403; -} - - -namespace Nf\Error\Exception\Http; - -use Nf\Error\Exception\Http; - -/** - * Gestion des exceptions pour le client avec passage d'array - */ -class BadRequest extends Http -{ - - public $doLog = false; - - protected $_httpStatus = 400; - - private $_errors = null; - - /** - * - * @param array $errors - */ - public function __construct($errors) - { - if (is_string($errors)) { - $errors = array( - $errors - ); - } - - $this->_errors = $errors; - parent::__construct(); - } - - public function getErrors() - { - return $this->_errors; - } - - public function display() - { - $front = \Nf\Front::getInstance(); - $response = $front->getResponse(); - $response->addBodyPart(json_encode($this->_errors)); - $response->sendResponse(); - } -} diff --git a/nofuss-1.2/cache/routes.all.php b/nofuss-1.2/cache/routes.all.php deleted file mode 100644 index d300f6c79..000000000 --- a/nofuss-1.2/cache/routes.all.php +++ /dev/null @@ -1,16 +0,0 @@ - - array ( - '*' => - array ( - 'home' => - array ( - 'name' => 'home', - 'regexp' => 'php-framework-benchmark/nofuss-1.2/html/index.php/hello/index', - 'controller' => 'home/index/index', - 'inheritableRegexp' => 'nofuss-1.2/html/index.php/hello/index', - ), - ), - ), -); \ No newline at end of file diff --git a/phalcon-1.3/public/index.php b/phalcon-1.3/public/index.php index 0692a1a0e..9e562dcda 100644 --- a/phalcon-1.3/public/index.php +++ b/phalcon-1.3/public/index.php @@ -30,4 +30,4 @@ echo $e->getMessage(); } -require $_SERVER['DOCUMENT_ROOT'].'/php-framework-benchmark/libs/output_data.php'; +require __DIR__ . '/../../libs/output_data.php'; diff --git a/phalcon-2.0/public/index.php b/phalcon-2.0/public/index.php index 0692a1a0e..9e562dcda 100644 --- a/phalcon-2.0/public/index.php +++ b/phalcon-2.0/public/index.php @@ -30,4 +30,4 @@ echo $e->getMessage(); } -require $_SERVER['DOCUMENT_ROOT'].'/php-framework-benchmark/libs/output_data.php'; +require __DIR__ . '/../../libs/output_data.php'; diff --git a/slim-3.0/index.php b/slim-3.0/index.php index d07cb7226..f62cc1838 100644 --- a/slim-3.0/index.php +++ b/slim-3.0/index.php @@ -5,9 +5,16 @@ $app = new \Slim\App(); $app->get('/hello/index', function ($request, $response, $args) { - return $response->write('Hello World!'); + return $response->write('Hello World!' . str_repeat('+', 22)); }); +ob_start(); $app->run(); +$output = ob_get_clean(); -require $_SERVER['DOCUMENT_ROOT'].'/php-framework-benchmark/libs/output_data.php'; +ob_start(); +// Doesn't work due to Content-Length header +require __DIR__ . '/../libs/output_data.php'; +$benchmarkData = ob_get_clean(); + +echo str_replace('+', ' ', str_replace(str_repeat('+', min(22, strlen($benchmarkData))), $benchmarkData, $output)); diff --git a/staticphp-0.9/Application/Cache/.gitkeep b/staticphp-0.9/Application/Cache/.gitkeep old mode 100644 new mode 100755 diff --git a/symfony-3.4-empty/.gitignore b/symfony-3.4-empty/.gitignore new file mode 100644 index 000000000..40e9c1007 --- /dev/null +++ b/symfony-3.4-empty/.gitignore @@ -0,0 +1,17 @@ +# Temporary Files +/var/* + +!/var/cache +/var/cache/* +!var/cache/.gitkeep + +!/var/logs +/var/logs/* +!var/logs/.gitkeep + +# Configuration +/app/config/parameters.yml + +# Third Party libraries +/vendor/ +/composer.phar diff --git a/symfony-3.4-empty/LICENSE b/symfony-3.4-empty/LICENSE new file mode 100644 index 000000000..5241ee57e --- /dev/null +++ b/symfony-3.4-empty/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2014-2015 Loïc Faugeron + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/symfony-3.4-empty/README.md b/symfony-3.4-empty/README.md new file mode 100644 index 000000000..3713fe968 --- /dev/null +++ b/symfony-3.4-empty/README.md @@ -0,0 +1,34 @@ +# Symfony Empty Edition + +A skeleton allowing you to create an empty Symfony application: it is provided without +any libraries or bundles (except for Symfony's FrameworkBundle). + +You can then start building on it, and install the dependencies you need. + +> **Note**: The [Symfony Standard Edition](https://github.com/symfony/symfony-standard) +> provides a big set of libraries and bundles (database, email, templating, etc). +> If you don't feel comfortable with picking your own yet, you should probably use it. + +## Installation + +Use [Composer](https://getcomposer.org/) to create a new application: + +``` +composer create-project gnugat/symfony-empty-edition my-project +``` + +## Differences with the Standard Edition + +* Only 2 bundles: `src/AppBundle` and `symfony/framework-bundle`, add the ones you really need +* Only 1 front controller (`web/app.php`), change the environment using the `SYMFONY_ENV` environment variable +* No annotations (can be brought back by installing `sensio/framework-extra-bundle`) + +## Use cases + +There are many real world use cases for this distribution. Here's a small selection: + +* tailored made applications: for applications that require "non standard" dependencies (e.g. Propel or Pomm for the database, etc) +* micro applications: for applications that don't need database, templating or mailing systems (Symfony can be a Micro Framework) +* legacy migrations: for applications that need to depend on legacy database, templating, etc while migrating to symfony +* teaching material: [better explained here](http://www.whitewashing.de/2014/04/24/symfony_hello_world.html) + diff --git a/symfony-3.4-empty/_benchmark/hello_world.sh b/symfony-3.4-empty/_benchmark/hello_world.sh new file mode 100644 index 000000000..9e6369133 --- /dev/null +++ b/symfony-3.4-empty/_benchmark/hello_world.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +url="$base/$fw/web/app.php/hello/index" diff --git a/symfony-3.4-empty/_benchmark/setup.sh b/symfony-3.4-empty/_benchmark/setup.sh new file mode 100644 index 000000000..0244cd4d5 --- /dev/null +++ b/symfony-3.4-empty/_benchmark/setup.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +export SYMFONY_ENV=prod +composer install --no-dev --optimize-autoloader +php bin/console cache:clear --env=prod --no-debug --no-warmup +php bin/console cache:warmup --env=prod --no-debug +chmod o+w var/cache/ var/logs/ +chmod -R o+w var/cache/* diff --git a/symfony-3.4-empty/app/AppKernel.php b/symfony-3.4-empty/app/AppKernel.php new file mode 100644 index 000000000..e45ccd8f1 --- /dev/null +++ b/symfony-3.4-empty/app/AppKernel.php @@ -0,0 +1,48 @@ +add('/hello/index', \AppBundle\Controller\HelloController::class . '::indexAction'); + } + + public function getRootDir() + { + return __DIR__; + } + + public function getCacheDir() + { + return dirname(__DIR__) . '/var/cache/' . $this->getEnvironment(); + } + + public function getLogDir() + { + return dirname(__DIR__) . '/var/logs'; + } + + protected function configureContainer(ContainerBuilder $c, LoaderInterface $loader) + { + $loader->load($this->getRootDir() . '/config/config_' . $this->getEnvironment() . '.yml'); + } +} diff --git a/symfony-3.4-empty/app/autoload.php b/symfony-3.4-empty/app/autoload.php new file mode 100644 index 000000000..991ea4397 --- /dev/null +++ b/symfony-3.4-empty/app/autoload.php @@ -0,0 +1,3 @@ +getParameterOption(array('--env', '-e'), 'dev'); +$debug = !$input->hasParameterOption(array('--no-debug', '')) && $env !== 'prod'; + +$kernel = new AppKernel($env, $debug); +$application = new KernelApplication($kernel); +$application->run($input); diff --git a/symfony-3.4-empty/composer.json b/symfony-3.4-empty/composer.json new file mode 100644 index 000000000..37b55ed5a --- /dev/null +++ b/symfony-3.4-empty/composer.json @@ -0,0 +1,35 @@ +{ + "name": "gnugat/symfony-empty-edition", + "license": "MIT", + "type": "project", + "description": "The \"Symfony Empty Edition\" distribution", + "autoload": { + "psr-4": { "": "src" }, + "files": [ "app/AppKernel.php" ] + }, + "autoload-dev": { + "psr-4": { "Tests\\": "tests" } + }, + "require": { + "php": "^5.5.9|^7.0", + "symfony/console": "^3.0", + "symfony/event-dispatcher": "^3.0", + "symfony/finder": "^3.0", + "symfony/yaml": "^3.0", + "incenteev/composer-parameter-handler": "^2.1", + "gnugat/micro-framework-bundle": "0.5.0" + }, + "scripts": { + "post-install-cmd": [ + "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters" + ], + "post-update-cmd": [ + "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters" + ] + }, + "extra": { + "incenteev-parameters": [ + { "file": "app/config/parameters.yml" } + ] + } +} diff --git a/symfony-3.4-empty/composer.lock b/symfony-3.4-empty/composer.lock new file mode 100644 index 000000000..30a7ea8cf --- /dev/null +++ b/symfony-3.4-empty/composer.lock @@ -0,0 +1,1038 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "content-hash": "8a0245f7f986cb0548da5da6fc82fc81", + "packages": [ + { + "name": "gnugat/micro-framework-bundle", + "version": "v0.5.0", + "source": { + "type": "git", + "url": "https://github.com/gnugat/micro-framework-bundle.git", + "reference": "fc426e68e891b456b9bff214f3d08d5509d5c8d0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/gnugat/micro-framework-bundle/zipball/fc426e68e891b456b9bff214f3d08d5509d5c8d0", + "reference": "fc426e68e891b456b9bff214f3d08d5509d5c8d0", + "shasum": "" + }, + "require": { + "php": "^5.5.9|^7.0", + "symfony/class-loader": "^3.0", + "symfony/config": "^3.0", + "symfony/console": "^3.0", + "symfony/dependency-injection": "^3.0", + "symfony/finder": "^3.0", + "symfony/http-kernel": "^3.0", + "symfony/routing": "^3.0" + }, + "require-dev": { + "league/tactician-bundle": "^0.4", + "phpunit/phpunit": "^5.0", + "symfony/monolog-bundle": "^2.0" + }, + "type": "symfony-bundle", + "autoload": { + "psr-4": { + "Gnugat\\MicroFrameworkBundle\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Loïc Faugeron", + "email": "faugeron.loic@gmail.com", + "homepage": "http://gnugat.github.io", + "role": "Developer" + } + ], + "description": "Symfony Micro Framework Bundle", + "homepage": "http://gnugat.github.io/micro-framework-bundle", + "keywords": [ + "bundle", + "framework", + "micro", + "symfony" + ], + "time": "2016-03-09T19:36:33+00:00" + }, + { + "name": "incenteev/composer-parameter-handler", + "version": "v2.1.2", + "source": { + "type": "git", + "url": "https://github.com/Incenteev/ParameterHandler.git", + "reference": "d7ce7f06136109e81d1cb9d57066c4d4a99cf1cc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Incenteev/ParameterHandler/zipball/d7ce7f06136109e81d1cb9d57066c4d4a99cf1cc", + "reference": "d7ce7f06136109e81d1cb9d57066c4d4a99cf1cc", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "symfony/yaml": "~2.3|~3.0" + }, + "require-dev": { + "composer/composer": "1.0.*@dev", + "phpspec/prophecy-phpunit": "~1.0", + "symfony/filesystem": "~2.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Incenteev\\ParameterHandler\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christophe Coevoet", + "email": "stof@notk.org" + } + ], + "description": "Composer script handling your ignored parameter file", + "homepage": "https://github.com/Incenteev/ParameterHandler", + "keywords": [ + "parameters management" + ], + "time": "2015-11-10T17:04:01+00:00" + }, + { + "name": "psr/container", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "time": "2017-02-14T16:28:37+00:00" + }, + { + "name": "psr/log", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2016-10-10T12:19:37+00:00" + }, + { + "name": "symfony/class-loader", + "version": "v3.4.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/class-loader.git", + "reference": "e63c12699822bb3b667e7216ba07fbcc3a3e203e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/class-loader/zipball/e63c12699822bb3b667e7216ba07fbcc3a3e203e", + "reference": "e63c12699822bb3b667e7216ba07fbcc3a3e203e", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "require-dev": { + "symfony/finder": "~2.8|~3.0|~4.0", + "symfony/polyfill-apcu": "~1.1" + }, + "suggest": { + "symfony/polyfill-apcu": "For using ApcClassLoader on HHVM" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\ClassLoader\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony ClassLoader Component", + "homepage": "https://symfony.com", + "time": "2018-01-03T07:37:34+00:00" + }, + { + "name": "symfony/config", + "version": "v3.4.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/config.git", + "reference": "cfd5c972f7b4992a5df41673d25d980ab077aa5b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/config/zipball/cfd5c972f7b4992a5df41673d25d980ab077aa5b", + "reference": "cfd5c972f7b4992a5df41673d25d980ab077aa5b", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "symfony/filesystem": "~2.8|~3.0|~4.0" + }, + "conflict": { + "symfony/dependency-injection": "<3.3", + "symfony/finder": "<3.3" + }, + "require-dev": { + "symfony/dependency-injection": "~3.3|~4.0", + "symfony/finder": "~3.3|~4.0", + "symfony/yaml": "~3.0|~4.0" + }, + "suggest": { + "symfony/yaml": "To use the yaml reference dumper" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Config\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Config Component", + "homepage": "https://symfony.com", + "time": "2018-01-03T07:37:34+00:00" + }, + { + "name": "symfony/console", + "version": "v3.4.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "8394c8ef121949e8f858f13bc1e34f05169e4e7d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/8394c8ef121949e8f858f13bc1e34f05169e4e7d", + "reference": "8394c8ef121949e8f858f13bc1e34f05169e4e7d", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "symfony/debug": "~2.8|~3.0|~4.0", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/dependency-injection": "<3.4", + "symfony/process": "<3.3" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~3.3|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/event-dispatcher": "~2.8|~3.0|~4.0", + "symfony/lock": "~3.4|~4.0", + "symfony/process": "~3.3|~4.0" + }, + "suggest": { + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/lock": "", + "symfony/process": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Console Component", + "homepage": "https://symfony.com", + "time": "2018-01-03T07:37:34+00:00" + }, + { + "name": "symfony/debug", + "version": "v4.0.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/debug.git", + "reference": "9ae4223a661b56a9abdce144de4886cca37f198f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/debug/zipball/9ae4223a661b56a9abdce144de4886cca37f198f", + "reference": "9ae4223a661b56a9abdce144de4886cca37f198f", + "shasum": "" + }, + "require": { + "php": "^7.1.3", + "psr/log": "~1.0" + }, + "conflict": { + "symfony/http-kernel": "<3.4" + }, + "require-dev": { + "symfony/http-kernel": "~3.4|~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Debug\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Debug Component", + "homepage": "https://symfony.com", + "time": "2018-01-03T17:15:19+00:00" + }, + { + "name": "symfony/dependency-injection", + "version": "v3.4.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/dependency-injection.git", + "reference": "35f957ca171a431710966bec6e2f8636d3b019c4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/35f957ca171a431710966bec6e2f8636d3b019c4", + "reference": "35f957ca171a431710966bec6e2f8636d3b019c4", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "psr/container": "^1.0" + }, + "conflict": { + "symfony/config": "<3.3.7", + "symfony/finder": "<3.3", + "symfony/proxy-manager-bridge": "<3.4", + "symfony/yaml": "<3.4" + }, + "provide": { + "psr/container-implementation": "1.0" + }, + "require-dev": { + "symfony/config": "~3.3|~4.0", + "symfony/expression-language": "~2.8|~3.0|~4.0", + "symfony/yaml": "~3.4|~4.0" + }, + "suggest": { + "symfony/config": "", + "symfony/expression-language": "For using expressions in service container configuration", + "symfony/finder": "For using double-star glob patterns or when GLOB_BRACE portability is required", + "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them", + "symfony/yaml": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\DependencyInjection\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony DependencyInjection Component", + "homepage": "https://symfony.com", + "time": "2018-01-04T15:56:45+00:00" + }, + { + "name": "symfony/event-dispatcher", + "version": "v3.4.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "26b87b6bca8f8f797331a30b76fdae5342dc26ca" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/26b87b6bca8f8f797331a30b76fdae5342dc26ca", + "reference": "26b87b6bca8f8f797331a30b76fdae5342dc26ca", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "conflict": { + "symfony/dependency-injection": "<3.3" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~2.8|~3.0|~4.0", + "symfony/dependency-injection": "~3.3|~4.0", + "symfony/expression-language": "~2.8|~3.0|~4.0", + "symfony/stopwatch": "~2.8|~3.0|~4.0" + }, + "suggest": { + "symfony/dependency-injection": "", + "symfony/http-kernel": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\EventDispatcher\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony EventDispatcher Component", + "homepage": "https://symfony.com", + "time": "2018-01-03T07:37:34+00:00" + }, + { + "name": "symfony/filesystem", + "version": "v4.0.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/filesystem.git", + "reference": "760e47a4ee64b4c48f4b30017011e09d4c0f05ed" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/760e47a4ee64b4c48f4b30017011e09d4c0f05ed", + "reference": "760e47a4ee64b4c48f4b30017011e09d4c0f05ed", + "shasum": "" + }, + "require": { + "php": "^7.1.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Filesystem\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Filesystem Component", + "homepage": "https://symfony.com", + "time": "2018-01-03T07:38:00+00:00" + }, + { + "name": "symfony/finder", + "version": "v3.4.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "613e26310776f49a1773b6737c6bd554b8bc8c6f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/finder/zipball/613e26310776f49a1773b6737c6bd554b8bc8c6f", + "reference": "613e26310776f49a1773b6737c6bd554b8bc8c6f", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Finder\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Finder Component", + "homepage": "https://symfony.com", + "time": "2018-01-03T07:37:34+00:00" + }, + { + "name": "symfony/http-foundation", + "version": "v4.0.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-foundation.git", + "reference": "03fe5171e35966f43453e2e5c15d7fe65f7fb23b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/03fe5171e35966f43453e2e5c15d7fe65f7fb23b", + "reference": "03fe5171e35966f43453e2e5c15d7fe65f7fb23b", + "shasum": "" + }, + "require": { + "php": "^7.1.3", + "symfony/polyfill-mbstring": "~1.1" + }, + "require-dev": { + "symfony/expression-language": "~3.4|~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\HttpFoundation\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony HttpFoundation Component", + "homepage": "https://symfony.com", + "time": "2018-01-03T17:15:19+00:00" + }, + { + "name": "symfony/http-kernel", + "version": "v3.4.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-kernel.git", + "reference": "1c2a82d6a8ec9b354fe4ef48ad1ad3f1a4f7db0e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/1c2a82d6a8ec9b354fe4ef48ad1ad3f1a4f7db0e", + "reference": "1c2a82d6a8ec9b354fe4ef48ad1ad3f1a4f7db0e", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "psr/log": "~1.0", + "symfony/debug": "~2.8|~3.0|~4.0", + "symfony/event-dispatcher": "~2.8|~3.0|~4.0", + "symfony/http-foundation": "^3.3.11|~4.0" + }, + "conflict": { + "symfony/config": "<2.8", + "symfony/dependency-injection": "<3.4", + "symfony/var-dumper": "<3.3", + "twig/twig": "<1.34|<2.4,>=2" + }, + "provide": { + "psr/log-implementation": "1.0" + }, + "require-dev": { + "psr/cache": "~1.0", + "symfony/browser-kit": "~2.8|~3.0|~4.0", + "symfony/class-loader": "~2.8|~3.0", + "symfony/config": "~2.8|~3.0|~4.0", + "symfony/console": "~2.8|~3.0|~4.0", + "symfony/css-selector": "~2.8|~3.0|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/dom-crawler": "~2.8|~3.0|~4.0", + "symfony/expression-language": "~2.8|~3.0|~4.0", + "symfony/finder": "~2.8|~3.0|~4.0", + "symfony/process": "~2.8|~3.0|~4.0", + "symfony/routing": "~3.4|~4.0", + "symfony/stopwatch": "~2.8|~3.0|~4.0", + "symfony/templating": "~2.8|~3.0|~4.0", + "symfony/translation": "~2.8|~3.0|~4.0", + "symfony/var-dumper": "~3.3|~4.0" + }, + "suggest": { + "symfony/browser-kit": "", + "symfony/config": "", + "symfony/console": "", + "symfony/dependency-injection": "", + "symfony/finder": "", + "symfony/var-dumper": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\HttpKernel\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony HttpKernel Component", + "homepage": "https://symfony.com", + "time": "2018-01-05T08:33:00+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.6.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", + "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2017-10-11T12:05:26+00:00" + }, + { + "name": "symfony/routing", + "version": "v3.4.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/routing.git", + "reference": "e2b6d6fe7b090c7af720b75c7722c6dfa7a52658" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/routing/zipball/e2b6d6fe7b090c7af720b75c7722c6dfa7a52658", + "reference": "e2b6d6fe7b090c7af720b75c7722c6dfa7a52658", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "conflict": { + "symfony/config": "<2.8", + "symfony/dependency-injection": "<3.3", + "symfony/yaml": "<3.4" + }, + "require-dev": { + "doctrine/annotations": "~1.0", + "doctrine/common": "~2.2", + "psr/log": "~1.0", + "symfony/config": "~2.8|~3.0|~4.0", + "symfony/dependency-injection": "~3.3|~4.0", + "symfony/expression-language": "~2.8|~3.0|~4.0", + "symfony/http-foundation": "~2.8|~3.0|~4.0", + "symfony/yaml": "~3.4|~4.0" + }, + "suggest": { + "doctrine/annotations": "For using the annotation loader", + "symfony/config": "For using the all-in-one router or any loader", + "symfony/dependency-injection": "For loading routes from a service", + "symfony/expression-language": "For using expression matching", + "symfony/http-foundation": "For using a Symfony Request object", + "symfony/yaml": "For using the YAML loader" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Routing\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Routing Component", + "homepage": "https://symfony.com", + "keywords": [ + "router", + "routing", + "uri", + "url" + ], + "time": "2018-01-04T15:09:34+00:00" + }, + { + "name": "symfony/yaml", + "version": "v3.4.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "25c192f25721a74084272671f658797d9e0e0146" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/25c192f25721a74084272671f658797d9e0e0146", + "reference": "25c192f25721a74084272671f658797d9e0e0146", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "conflict": { + "symfony/console": "<3.4" + }, + "require-dev": { + "symfony/console": "~3.4|~4.0" + }, + "suggest": { + "symfony/console": "For validating YAML files using the lint command" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Yaml\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Yaml Component", + "homepage": "https://symfony.com", + "time": "2018-01-03T07:37:34+00:00" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": "^5.5.9|^7.0" + }, + "platform-dev": [] +} diff --git a/symfony-3.4-empty/src/AppBundle/AppBundle.php b/symfony-3.4-empty/src/AppBundle/AppBundle.php new file mode 100644 index 000000000..05123b678 --- /dev/null +++ b/symfony-3.4-empty/src/AppBundle/AppBundle.php @@ -0,0 +1,9 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace AppBundle\Kernel; + +use Symfony\Component\Config\Loader\LoaderInterface; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Symfony\Component\Routing\RouteCollectionBuilder; + +/** + * A Kernel that provides configuration hooks. + * + * @author Ryan Weaver + * @author Fabien Potencier + */ +trait MicroKernelTrait +{ + /** + * Add or import routes into your application. + * + * $routes->import('config/routing.yml'); + * $routes->add('/admin', 'AppBundle:Admin:dashboard', 'admin_dashboard'); + * + * @param RouteCollectionBuilder $routes + */ + abstract protected function configureRoutes(RouteCollectionBuilder $routes); + + /** + * Configures the container. + * + * You can register extensions: + * + * $c->loadFromExtension('framework', array( + * 'secret' => '%secret%' + * )); + * + * Or services: + * + * $c->register('halloween', 'FooBundle\HalloweenProvider'); + * + * Or parameters: + * + * $c->setParameter('halloween', 'lot of fun'); + * + * @param ContainerBuilder $c + * @param LoaderInterface $loader + */ + abstract protected function configureContainer(ContainerBuilder $c, LoaderInterface $loader); + + /** + * {@inheritdoc} + */ + public function registerContainerConfiguration(LoaderInterface $loader) + { + $loader->load(function (ContainerBuilder $container) use ($loader) { + $container->loadFromExtension('gnugat_micro_framework', array( + 'router' => array( + 'resource' => 'kernel:loadRoutes', + 'type' => 'service', + ), + )); + + if ($this instanceof EventSubscriberInterface) { + $container->register('kernel', static::class) + ->setSynthetic(true) + ->setPublic(true) + ->addTag('kernel.event_subscriber') + ; + } + + $this->configureContainer($container, $loader); + + $container->addObjectResource($this); + }); + } + + /** + * @internal + */ + public function loadRoutes(LoaderInterface $loader) + { + $routes = new RouteCollectionBuilder($loader); + $this->configureRoutes($routes); + + return $routes->build(); + } +} diff --git a/symfony-3.4-empty/var/cache/.gitkeep b/symfony-3.4-empty/var/cache/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/symfony-3.4-empty/var/logs/.gitkeep b/symfony-3.4-empty/var/logs/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/symfony-3.4-empty/web/app.php b/symfony-3.4-empty/web/app.php new file mode 100644 index 000000000..33eb67506 --- /dev/null +++ b/symfony-3.4-empty/web/app.php @@ -0,0 +1,17 @@ +loadClassCache(); +Request::enableHttpMethodParameterOverride(); +$request = Request::createFromGlobals(); +$response = $kernel->handle($request); +$response->send(); + +require __DIR__ . '/../../libs/output_data.php'; diff --git a/symfony-3.4-empty/web/favicon.ico b/symfony-3.4-empty/web/favicon.ico new file mode 100644 index 000000000..526c2581c Binary files /dev/null and b/symfony-3.4-empty/web/favicon.ico differ diff --git a/symfony-3.4-empty/web/robots.txt b/symfony-3.4-empty/web/robots.txt new file mode 100644 index 000000000..214e41196 --- /dev/null +++ b/symfony-3.4-empty/web/robots.txt @@ -0,0 +1,4 @@ +# www.robotstxt.org/ +# www.google.com/support/webmasters/bin/answer.py?hl=en&answer=156449 + +User-agent: * diff --git a/symfony-3.4-micro/.gitignore b/symfony-3.4-micro/.gitignore new file mode 100644 index 000000000..93821ad1c --- /dev/null +++ b/symfony-3.4-micro/.gitignore @@ -0,0 +1,16 @@ +/app/config/parameters.yml +/build/ +/phpunit.xml +/var/* +!/var/cache +/var/cache/* +!var/cache/.gitkeep +!/var/logs +/var/logs/* +!var/logs/.gitkeep +!/var/sessions +/var/sessions/* +!var/sessions/.gitkeep +!var/SymfonyRequirements.php +/vendor/ +/web/bundles/ diff --git a/symfony-3.4-micro/README.md b/symfony-3.4-micro/README.md new file mode 100644 index 000000000..c4b1d8308 --- /dev/null +++ b/symfony-3.4-micro/README.md @@ -0,0 +1,4 @@ +symfony-3.4 +=========== + +A Symfony project with [micro kernel](https://symfony.com/doc/current/configuration/micro_kernel_trait.html) diff --git a/symfony-3.4-micro/_benchmark/hello_world.sh b/symfony-3.4-micro/_benchmark/hello_world.sh new file mode 100644 index 000000000..bfcc348cc --- /dev/null +++ b/symfony-3.4-micro/_benchmark/hello_world.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +url="$base/$fw/web/micro.php/hello/index" diff --git a/symfony-3.4-micro/_benchmark/setup.sh b/symfony-3.4-micro/_benchmark/setup.sh new file mode 100644 index 000000000..0244cd4d5 --- /dev/null +++ b/symfony-3.4-micro/_benchmark/setup.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +export SYMFONY_ENV=prod +composer install --no-dev --optimize-autoloader +php bin/console cache:clear --env=prod --no-debug --no-warmup +php bin/console cache:warmup --env=prod --no-debug +chmod o+w var/cache/ var/logs/ +chmod -R o+w var/cache/* diff --git a/symfony-3.4-micro/app/AppCache.php b/symfony-3.4-micro/app/AppCache.php new file mode 100644 index 000000000..639ec2cd7 --- /dev/null +++ b/symfony-3.4-micro/app/AppCache.php @@ -0,0 +1,7 @@ +add('/hello/index', \App\Controller\HelloController::class . '::indexAction'); + } + + public function getRootDir() + { + return __DIR__; + } + + public function getCacheDir() + { + return dirname(__DIR__).'/var/cache/'.$this->getEnvironment(); + } + + public function getLogDir() + { + return dirname(__DIR__).'/var/logs'; + } + + protected function configureContainer(ContainerBuilder $c, LoaderInterface $loader) + { + $loader->load($this->getRootDir() . '/config/config_'.$this->getEnvironment().'.yml'); + } +} diff --git a/symfony-3.4-micro/app/autoload.php b/symfony-3.4-micro/app/autoload.php new file mode 100644 index 000000000..545c536b9 --- /dev/null +++ b/symfony-3.4-micro/app/autoload.php @@ -0,0 +1,13 @@ +getParameterOption(['--env', '-e'], getenv('SYMFONY_ENV') ?: 'dev'); +$debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(['--no-debug', '']) && $env !== 'prod'; + +if ($debug) { + Debug::enable(); +} + +$kernel = new AppKernel($env, $debug); +$application = new Application($kernel); +$application->run($input); diff --git a/symfony-3.4-micro/bin/symfony_requirements b/symfony-3.4-micro/bin/symfony_requirements new file mode 100755 index 000000000..a7bf65a1b --- /dev/null +++ b/symfony-3.4-micro/bin/symfony_requirements @@ -0,0 +1,146 @@ +#!/usr/bin/env php +getPhpIniConfigPath(); + +echo_title('Symfony Requirements Checker'); + +echo '> PHP is using the following php.ini file:'.PHP_EOL; +if ($iniPath) { + echo_style('green', ' '.$iniPath); +} else { + echo_style('yellow', ' WARNING: No configuration file (php.ini) used by PHP!'); +} + +echo PHP_EOL.PHP_EOL; + +echo '> Checking Symfony requirements:'.PHP_EOL.' '; + +$messages = array(); +foreach ($symfonyRequirements->getRequirements() as $req) { + if ($helpText = get_error_message($req, $lineSize)) { + echo_style('red', 'E'); + $messages['error'][] = $helpText; + } else { + echo_style('green', '.'); + } +} + +$checkPassed = empty($messages['error']); + +foreach ($symfonyRequirements->getRecommendations() as $req) { + if ($helpText = get_error_message($req, $lineSize)) { + echo_style('yellow', 'W'); + $messages['warning'][] = $helpText; + } else { + echo_style('green', '.'); + } +} + +if ($checkPassed) { + echo_block('success', 'OK', 'Your system is ready to run Symfony projects'); +} else { + echo_block('error', 'ERROR', 'Your system is not ready to run Symfony projects'); + + echo_title('Fix the following mandatory requirements', 'red'); + + foreach ($messages['error'] as $helpText) { + echo ' * '.$helpText.PHP_EOL; + } +} + +if (!empty($messages['warning'])) { + echo_title('Optional recommendations to improve your setup', 'yellow'); + + foreach ($messages['warning'] as $helpText) { + echo ' * '.$helpText.PHP_EOL; + } +} + +echo PHP_EOL; +echo_style('title', 'Note'); +echo ' The command console could use a different php.ini file'.PHP_EOL; +echo_style('title', '~~~~'); +echo ' than the one used with your web server. To be on the'.PHP_EOL; +echo ' safe side, please check the requirements from your web'.PHP_EOL; +echo ' server using the '; +echo_style('yellow', 'web/config.php'); +echo ' script.'.PHP_EOL; +echo PHP_EOL; + +exit($checkPassed ? 0 : 1); + +function get_error_message(Requirement $requirement, $lineSize) +{ + if ($requirement->isFulfilled()) { + return; + } + + $errorMessage = wordwrap($requirement->getTestMessage(), $lineSize - 3, PHP_EOL.' ').PHP_EOL; + $errorMessage .= ' > '.wordwrap($requirement->getHelpText(), $lineSize - 5, PHP_EOL.' > ').PHP_EOL; + + return $errorMessage; +} + +function echo_title($title, $style = null) +{ + $style = $style ?: 'title'; + + echo PHP_EOL; + echo_style($style, $title.PHP_EOL); + echo_style($style, str_repeat('~', strlen($title)).PHP_EOL); + echo PHP_EOL; +} + +function echo_style($style, $message) +{ + // ANSI color codes + $styles = array( + 'reset' => "\033[0m", + 'red' => "\033[31m", + 'green' => "\033[32m", + 'yellow' => "\033[33m", + 'error' => "\033[37;41m", + 'success' => "\033[37;42m", + 'title' => "\033[34m", + ); + $supports = has_color_support(); + + echo($supports ? $styles[$style] : '').$message.($supports ? $styles['reset'] : ''); +} + +function echo_block($style, $title, $message) +{ + $message = ' '.trim($message).' '; + $width = strlen($message); + + echo PHP_EOL.PHP_EOL; + + echo_style($style, str_repeat(' ', $width)); + echo PHP_EOL; + echo_style($style, str_pad(' ['.$title.']', $width, ' ', STR_PAD_RIGHT)); + echo PHP_EOL; + echo_style($style, $message); + echo PHP_EOL; + echo_style($style, str_repeat(' ', $width)); + echo PHP_EOL; +} + +function has_color_support() +{ + static $support; + + if (null === $support) { + if (DIRECTORY_SEPARATOR == '\\') { + $support = false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI'); + } else { + $support = function_exists('posix_isatty') && @posix_isatty(STDOUT); + } + } + + return $support; +} diff --git a/symfony-3.4-micro/composer.json b/symfony-3.4-micro/composer.json new file mode 100644 index 000000000..27e546ac0 --- /dev/null +++ b/symfony-3.4-micro/composer.json @@ -0,0 +1,51 @@ +{ + "name": "kenji/symfony-3.3-micro", + "license": "proprietary", + "type": "project", + "autoload": { + "psr-4": { + "": "src/" + }, + "classmap": [ + "app/AppKernel.php", + "app/AppCache.php" + ] + }, + "require": { + "incenteev/composer-parameter-handler": "^2.0", + "php": "^5.5.9|>=7.0.8", + "sensio/distribution-bundle": "^5.0", + "symfony/framework-bundle": "3.4.*", + "symfony/monolog-bundle": "^2.8", + "symfony/yaml": "^3.4" + }, + "scripts": { + "post-install-cmd": [ + "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters", + "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap", + "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache" + ], + "post-update-cmd": [ + "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters", + "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap", + "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache" + ] + }, + "config": { + "platform": { + "php": "5.5.9" + }, + "sort-packages": true + }, + "extra": { + "symfony-app-dir": "app", + "symfony-bin-dir": "bin", + "symfony-var-dir": "var", + "symfony-web-dir": "web", + "symfony-tests-dir": "tests", + "symfony-assets-install": "relative", + "incenteev-parameters": { + "file": "app/config/parameters.yml" + } + } +} diff --git a/symfony-3.4-micro/composer.lock b/symfony-3.4-micro/composer.lock new file mode 100644 index 000000000..91c9e55e5 --- /dev/null +++ b/symfony-3.4-micro/composer.lock @@ -0,0 +1,1830 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "content-hash": "928dce99b2637a951b7498e031c2027e", + "packages": [ + { + "name": "composer/ca-bundle", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/composer/ca-bundle.git", + "reference": "943b2c4fcad1ef178d16a713c2468bf7e579c288" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/ca-bundle/zipball/943b2c4fcad1ef178d16a713c2468bf7e579c288", + "reference": "943b2c4fcad1ef178d16a713c2468bf7e579c288", + "shasum": "" + }, + "require": { + "ext-openssl": "*", + "ext-pcre": "*", + "php": "^5.3.2 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35", + "psr/log": "^1.0", + "symfony/process": "^2.5 || ^3.0 || ^4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\CaBundle\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.", + "keywords": [ + "cabundle", + "cacert", + "certificate", + "ssl", + "tls" + ], + "time": "2017-11-29T09:37:33+00:00" + }, + { + "name": "incenteev/composer-parameter-handler", + "version": "v2.1.2", + "source": { + "type": "git", + "url": "https://github.com/Incenteev/ParameterHandler.git", + "reference": "d7ce7f06136109e81d1cb9d57066c4d4a99cf1cc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Incenteev/ParameterHandler/zipball/d7ce7f06136109e81d1cb9d57066c4d4a99cf1cc", + "reference": "d7ce7f06136109e81d1cb9d57066c4d4a99cf1cc", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "symfony/yaml": "~2.3|~3.0" + }, + "require-dev": { + "composer/composer": "1.0.*@dev", + "phpspec/prophecy-phpunit": "~1.0", + "symfony/filesystem": "~2.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Incenteev\\ParameterHandler\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christophe Coevoet", + "email": "stof@notk.org" + } + ], + "description": "Composer script handling your ignored parameter file", + "homepage": "https://github.com/Incenteev/ParameterHandler", + "keywords": [ + "parameters management" + ], + "time": "2015-11-10T17:04:01+00:00" + }, + { + "name": "monolog/monolog", + "version": "1.23.0", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/monolog.git", + "reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/fd8c787753b3a2ad11bc60c063cff1358a32a3b4", + "reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "psr/log": "~1.0" + }, + "provide": { + "psr/log-implementation": "1.0.0" + }, + "require-dev": { + "aws/aws-sdk-php": "^2.4.9 || ^3.0", + "doctrine/couchdb": "~1.0@dev", + "graylog2/gelf-php": "~1.0", + "jakub-onderka/php-parallel-lint": "0.9", + "php-amqplib/php-amqplib": "~2.4", + "php-console/php-console": "^3.1.3", + "phpunit/phpunit": "~4.5", + "phpunit/phpunit-mock-objects": "2.3.0", + "ruflin/elastica": ">=0.90 <3.0", + "sentry/sentry": "^0.13", + "swiftmailer/swiftmailer": "^5.3|^6.0" + }, + "suggest": { + "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", + "doctrine/couchdb": "Allow sending log messages to a CouchDB server", + "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", + "ext-mongo": "Allow sending log messages to a MongoDB server", + "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", + "mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver", + "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", + "php-console/php-console": "Allow sending log messages to Google Chrome", + "rollbar/rollbar": "Allow sending log messages to Rollbar", + "ruflin/elastica": "Allow sending log messages to an Elastic Search server", + "sentry/sentry": "Allow sending log messages to a Sentry server" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Monolog\\": "src/Monolog" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "Sends your logs to files, sockets, inboxes, databases and various web services", + "homepage": "http://github.com/Seldaek/monolog", + "keywords": [ + "log", + "logging", + "psr-3" + ], + "time": "2017-06-19T01:22:40+00:00" + }, + { + "name": "paragonie/random_compat", + "version": "v2.0.11", + "source": { + "type": "git", + "url": "https://github.com/paragonie/random_compat.git", + "reference": "5da4d3c796c275c55f057af5a643ae297d96b4d8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/5da4d3c796c275c55f057af5a643ae297d96b4d8", + "reference": "5da4d3c796c275c55f057af5a643ae297d96b4d8", + "shasum": "" + }, + "require": { + "php": ">=5.2.0" + }, + "require-dev": { + "phpunit/phpunit": "4.*|5.*" + }, + "suggest": { + "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." + }, + "type": "library", + "autoload": { + "files": [ + "lib/random.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Paragon Initiative Enterprises", + "email": "security@paragonie.com", + "homepage": "https://paragonie.com" + } + ], + "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", + "keywords": [ + "csprng", + "pseudorandom", + "random" + ], + "time": "2017-09-27T21:40:39+00:00" + }, + { + "name": "psr/cache", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/cache.git", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for caching libraries", + "keywords": [ + "cache", + "psr", + "psr-6" + ], + "time": "2016-08-06T20:24:11+00:00" + }, + { + "name": "psr/container", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "time": "2017-02-14T16:28:37+00:00" + }, + { + "name": "psr/log", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2016-10-10T12:19:37+00:00" + }, + { + "name": "psr/simple-cache", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/simple-cache.git", + "reference": "753fa598e8f3b9966c886fe13f370baa45ef0e24" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/753fa598e8f3b9966c886fe13f370baa45ef0e24", + "reference": "753fa598e8f3b9966c886fe13f370baa45ef0e24", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\SimpleCache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interfaces for simple caching", + "keywords": [ + "cache", + "caching", + "psr", + "psr-16", + "simple-cache" + ], + "time": "2017-01-02T13:31:39+00:00" + }, + { + "name": "sensio/distribution-bundle", + "version": "v5.0.21", + "source": { + "type": "git", + "url": "https://github.com/sensiolabs/SensioDistributionBundle.git", + "reference": "eb6266b3b472e4002538610b28a0a04bcf94891a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sensiolabs/SensioDistributionBundle/zipball/eb6266b3b472e4002538610b28a0a04bcf94891a", + "reference": "eb6266b3b472e4002538610b28a0a04bcf94891a", + "shasum": "" + }, + "require": { + "php": ">=5.3.9", + "sensiolabs/security-checker": "~3.0|~4.0", + "symfony/class-loader": "~2.3|~3.0", + "symfony/config": "~2.3|~3.0", + "symfony/dependency-injection": "~2.3|~3.0", + "symfony/filesystem": "~2.3|~3.0", + "symfony/http-kernel": "~2.3|~3.0", + "symfony/process": "~2.3|~3.0" + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-master": "5.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Sensio\\Bundle\\DistributionBundle\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Base bundle for Symfony Distributions", + "keywords": [ + "configuration", + "distribution" + ], + "time": "2017-08-25T16:55:44+00:00" + }, + { + "name": "sensiolabs/security-checker", + "version": "v4.1.7", + "source": { + "type": "git", + "url": "https://github.com/sensiolabs/security-checker.git", + "reference": "d539ccba2b4dce515de04f16b7ed7ae5b9eeb434" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sensiolabs/security-checker/zipball/d539ccba2b4dce515de04f16b7ed7ae5b9eeb434", + "reference": "d539ccba2b4dce515de04f16b7ed7ae5b9eeb434", + "shasum": "" + }, + "require": { + "composer/ca-bundle": "^1.0", + "symfony/console": "~2.7|~3.0|~4.0" + }, + "bin": [ + "security-checker" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.1-dev" + } + }, + "autoload": { + "psr-0": { + "SensioLabs\\Security": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien.potencier@gmail.com" + } + ], + "description": "A security checker for your composer.lock", + "time": "2018-01-11T05:54:03+00:00" + }, + { + "name": "symfony/cache", + "version": "v3.4.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/cache.git", + "reference": "5725378078bc4e1fe3c3414e9cc0e63d7de47fff" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/cache/zipball/5725378078bc4e1fe3c3414e9cc0e63d7de47fff", + "reference": "5725378078bc4e1fe3c3414e9cc0e63d7de47fff", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "psr/cache": "~1.0", + "psr/log": "~1.0", + "psr/simple-cache": "^1.0", + "symfony/polyfill-apcu": "~1.1" + }, + "conflict": { + "symfony/var-dumper": "<3.3" + }, + "provide": { + "psr/cache-implementation": "1.0", + "psr/simple-cache-implementation": "1.0" + }, + "require-dev": { + "cache/integration-tests": "dev-master", + "doctrine/cache": "~1.6", + "doctrine/dbal": "~2.4", + "predis/predis": "~1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Cache\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Cache component with PSR-6, PSR-16, and tags", + "homepage": "https://symfony.com", + "keywords": [ + "caching", + "psr6" + ], + "time": "2018-01-03T17:14:19+00:00" + }, + { + "name": "symfony/class-loader", + "version": "v3.4.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/class-loader.git", + "reference": "e63c12699822bb3b667e7216ba07fbcc3a3e203e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/class-loader/zipball/e63c12699822bb3b667e7216ba07fbcc3a3e203e", + "reference": "e63c12699822bb3b667e7216ba07fbcc3a3e203e", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "require-dev": { + "symfony/finder": "~2.8|~3.0|~4.0", + "symfony/polyfill-apcu": "~1.1" + }, + "suggest": { + "symfony/polyfill-apcu": "For using ApcClassLoader on HHVM" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\ClassLoader\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony ClassLoader Component", + "homepage": "https://symfony.com", + "time": "2018-01-03T07:37:34+00:00" + }, + { + "name": "symfony/config", + "version": "v3.4.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/config.git", + "reference": "cfd5c972f7b4992a5df41673d25d980ab077aa5b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/config/zipball/cfd5c972f7b4992a5df41673d25d980ab077aa5b", + "reference": "cfd5c972f7b4992a5df41673d25d980ab077aa5b", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "symfony/filesystem": "~2.8|~3.0|~4.0" + }, + "conflict": { + "symfony/dependency-injection": "<3.3", + "symfony/finder": "<3.3" + }, + "require-dev": { + "symfony/dependency-injection": "~3.3|~4.0", + "symfony/finder": "~3.3|~4.0", + "symfony/yaml": "~3.0|~4.0" + }, + "suggest": { + "symfony/yaml": "To use the yaml reference dumper" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Config\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Config Component", + "homepage": "https://symfony.com", + "time": "2018-01-03T07:37:34+00:00" + }, + { + "name": "symfony/console", + "version": "v3.4.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "8394c8ef121949e8f858f13bc1e34f05169e4e7d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/8394c8ef121949e8f858f13bc1e34f05169e4e7d", + "reference": "8394c8ef121949e8f858f13bc1e34f05169e4e7d", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "symfony/debug": "~2.8|~3.0|~4.0", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/dependency-injection": "<3.4", + "symfony/process": "<3.3" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~3.3|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/event-dispatcher": "~2.8|~3.0|~4.0", + "symfony/lock": "~3.4|~4.0", + "symfony/process": "~3.3|~4.0" + }, + "suggest": { + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/lock": "", + "symfony/process": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Console Component", + "homepage": "https://symfony.com", + "time": "2018-01-03T07:37:34+00:00" + }, + { + "name": "symfony/debug", + "version": "v3.4.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/debug.git", + "reference": "603b95dda8b00020e4e6e60dc906e7b715b1c245" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/debug/zipball/603b95dda8b00020e4e6e60dc906e7b715b1c245", + "reference": "603b95dda8b00020e4e6e60dc906e7b715b1c245", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "psr/log": "~1.0" + }, + "conflict": { + "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" + }, + "require-dev": { + "symfony/http-kernel": "~2.8|~3.0|~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Debug\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Debug Component", + "homepage": "https://symfony.com", + "time": "2018-01-03T17:14:19+00:00" + }, + { + "name": "symfony/dependency-injection", + "version": "v3.4.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/dependency-injection.git", + "reference": "35f957ca171a431710966bec6e2f8636d3b019c4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/35f957ca171a431710966bec6e2f8636d3b019c4", + "reference": "35f957ca171a431710966bec6e2f8636d3b019c4", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "psr/container": "^1.0" + }, + "conflict": { + "symfony/config": "<3.3.7", + "symfony/finder": "<3.3", + "symfony/proxy-manager-bridge": "<3.4", + "symfony/yaml": "<3.4" + }, + "provide": { + "psr/container-implementation": "1.0" + }, + "require-dev": { + "symfony/config": "~3.3|~4.0", + "symfony/expression-language": "~2.8|~3.0|~4.0", + "symfony/yaml": "~3.4|~4.0" + }, + "suggest": { + "symfony/config": "", + "symfony/expression-language": "For using expressions in service container configuration", + "symfony/finder": "For using double-star glob patterns or when GLOB_BRACE portability is required", + "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them", + "symfony/yaml": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\DependencyInjection\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony DependencyInjection Component", + "homepage": "https://symfony.com", + "time": "2018-01-04T15:56:45+00:00" + }, + { + "name": "symfony/event-dispatcher", + "version": "v3.4.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "26b87b6bca8f8f797331a30b76fdae5342dc26ca" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/26b87b6bca8f8f797331a30b76fdae5342dc26ca", + "reference": "26b87b6bca8f8f797331a30b76fdae5342dc26ca", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "conflict": { + "symfony/dependency-injection": "<3.3" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~2.8|~3.0|~4.0", + "symfony/dependency-injection": "~3.3|~4.0", + "symfony/expression-language": "~2.8|~3.0|~4.0", + "symfony/stopwatch": "~2.8|~3.0|~4.0" + }, + "suggest": { + "symfony/dependency-injection": "", + "symfony/http-kernel": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\EventDispatcher\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony EventDispatcher Component", + "homepage": "https://symfony.com", + "time": "2018-01-03T07:37:34+00:00" + }, + { + "name": "symfony/filesystem", + "version": "v3.4.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/filesystem.git", + "reference": "e078773ad6354af38169faf31c21df0f18ace03d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/e078773ad6354af38169faf31c21df0f18ace03d", + "reference": "e078773ad6354af38169faf31c21df0f18ace03d", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Filesystem\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Filesystem Component", + "homepage": "https://symfony.com", + "time": "2018-01-03T07:37:34+00:00" + }, + { + "name": "symfony/finder", + "version": "v3.4.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "613e26310776f49a1773b6737c6bd554b8bc8c6f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/finder/zipball/613e26310776f49a1773b6737c6bd554b8bc8c6f", + "reference": "613e26310776f49a1773b6737c6bd554b8bc8c6f", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Finder\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Finder Component", + "homepage": "https://symfony.com", + "time": "2018-01-03T07:37:34+00:00" + }, + { + "name": "symfony/framework-bundle", + "version": "v3.4.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/framework-bundle.git", + "reference": "41882368efe6c740f7aab9dd6da250c44eb550cf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/framework-bundle/zipball/41882368efe6c740f7aab9dd6da250c44eb550cf", + "reference": "41882368efe6c740f7aab9dd6da250c44eb550cf", + "shasum": "" + }, + "require": { + "ext-xml": "*", + "php": "^5.5.9|>=7.0.8", + "symfony/cache": "~3.4|~4.0", + "symfony/class-loader": "~3.2", + "symfony/config": "~3.4|~4.0", + "symfony/dependency-injection": "^3.4.3|^4.0.3", + "symfony/event-dispatcher": "~3.4|~4.0", + "symfony/filesystem": "~2.8|~3.0|~4.0", + "symfony/finder": "~2.8|~3.0|~4.0", + "symfony/http-foundation": "^3.3.11|~4.0", + "symfony/http-kernel": "~3.4|~4.0", + "symfony/polyfill-mbstring": "~1.0", + "symfony/routing": "~3.4|~4.0" + }, + "conflict": { + "phpdocumentor/reflection-docblock": "<3.0", + "phpdocumentor/type-resolver": "<0.2.1", + "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0", + "symfony/asset": "<3.3", + "symfony/console": "<3.4", + "symfony/form": "<3.4", + "symfony/property-info": "<3.3", + "symfony/serializer": "<3.3", + "symfony/stopwatch": "<3.4", + "symfony/translation": "<3.4", + "symfony/validator": "<3.4", + "symfony/workflow": "<3.3" + }, + "require-dev": { + "doctrine/annotations": "~1.0", + "doctrine/cache": "~1.0", + "fig/link-util": "^1.0", + "phpdocumentor/reflection-docblock": "^3.0|^4.0", + "symfony/asset": "~3.3|~4.0", + "symfony/browser-kit": "~2.8|~3.0|~4.0", + "symfony/console": "~3.4|~4.0", + "symfony/css-selector": "~2.8|~3.0|~4.0", + "symfony/dom-crawler": "~2.8|~3.0|~4.0", + "symfony/expression-language": "~2.8|~3.0|~4.0", + "symfony/form": "~3.4|~4.0", + "symfony/lock": "~3.4|~4.0", + "symfony/polyfill-intl-icu": "~1.0", + "symfony/process": "~2.8|~3.0|~4.0", + "symfony/property-info": "~3.3|~4.0", + "symfony/security": "~2.8|~3.0|~4.0", + "symfony/security-core": "~3.2|~4.0", + "symfony/security-csrf": "~2.8|~3.0|~4.0", + "symfony/serializer": "~3.3|~4.0", + "symfony/stopwatch": "~3.4|~4.0", + "symfony/templating": "~2.8|~3.0|~4.0", + "symfony/translation": "~3.4|~4.0", + "symfony/validator": "~3.4|~4.0", + "symfony/var-dumper": "~3.3|~4.0", + "symfony/web-link": "~3.3|~4.0", + "symfony/workflow": "~3.3|~4.0", + "symfony/yaml": "~3.2|~4.0", + "twig/twig": "~1.34|~2.4" + }, + "suggest": { + "ext-apcu": "For best performance of the system caches", + "symfony/console": "For using the console commands", + "symfony/form": "For using forms", + "symfony/property-info": "For using the property_info service", + "symfony/serializer": "For using the serializer service", + "symfony/validator": "For using validation", + "symfony/web-link": "For using web links, features such as preloading, prefetching or prerendering", + "symfony/yaml": "For using the debug:config and lint:yaml commands" + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Bundle\\FrameworkBundle\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony FrameworkBundle", + "homepage": "https://symfony.com", + "time": "2018-01-04T15:42:01+00:00" + }, + { + "name": "symfony/http-foundation", + "version": "v3.4.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-foundation.git", + "reference": "4a213be1cc8598089b8c7451529a2927b49b5d26" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/4a213be1cc8598089b8c7451529a2927b49b5d26", + "reference": "4a213be1cc8598089b8c7451529a2927b49b5d26", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "symfony/polyfill-mbstring": "~1.1", + "symfony/polyfill-php70": "~1.6" + }, + "require-dev": { + "symfony/expression-language": "~2.8|~3.0|~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\HttpFoundation\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony HttpFoundation Component", + "homepage": "https://symfony.com", + "time": "2018-01-03T17:14:19+00:00" + }, + { + "name": "symfony/http-kernel", + "version": "v3.4.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-kernel.git", + "reference": "1c2a82d6a8ec9b354fe4ef48ad1ad3f1a4f7db0e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/1c2a82d6a8ec9b354fe4ef48ad1ad3f1a4f7db0e", + "reference": "1c2a82d6a8ec9b354fe4ef48ad1ad3f1a4f7db0e", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "psr/log": "~1.0", + "symfony/debug": "~2.8|~3.0|~4.0", + "symfony/event-dispatcher": "~2.8|~3.0|~4.0", + "symfony/http-foundation": "^3.3.11|~4.0" + }, + "conflict": { + "symfony/config": "<2.8", + "symfony/dependency-injection": "<3.4", + "symfony/var-dumper": "<3.3", + "twig/twig": "<1.34|<2.4,>=2" + }, + "provide": { + "psr/log-implementation": "1.0" + }, + "require-dev": { + "psr/cache": "~1.0", + "symfony/browser-kit": "~2.8|~3.0|~4.0", + "symfony/class-loader": "~2.8|~3.0", + "symfony/config": "~2.8|~3.0|~4.0", + "symfony/console": "~2.8|~3.0|~4.0", + "symfony/css-selector": "~2.8|~3.0|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/dom-crawler": "~2.8|~3.0|~4.0", + "symfony/expression-language": "~2.8|~3.0|~4.0", + "symfony/finder": "~2.8|~3.0|~4.0", + "symfony/process": "~2.8|~3.0|~4.0", + "symfony/routing": "~3.4|~4.0", + "symfony/stopwatch": "~2.8|~3.0|~4.0", + "symfony/templating": "~2.8|~3.0|~4.0", + "symfony/translation": "~2.8|~3.0|~4.0", + "symfony/var-dumper": "~3.3|~4.0" + }, + "suggest": { + "symfony/browser-kit": "", + "symfony/config": "", + "symfony/console": "", + "symfony/dependency-injection": "", + "symfony/finder": "", + "symfony/var-dumper": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\HttpKernel\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony HttpKernel Component", + "homepage": "https://symfony.com", + "time": "2018-01-05T08:33:00+00:00" + }, + { + "name": "symfony/monolog-bridge", + "version": "v3.4.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/monolog-bridge.git", + "reference": "d00a3eae96da210e44ce0b6a8fa72ee737703861" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/monolog-bridge/zipball/d00a3eae96da210e44ce0b6a8fa72ee737703861", + "reference": "d00a3eae96da210e44ce0b6a8fa72ee737703861", + "shasum": "" + }, + "require": { + "monolog/monolog": "~1.19", + "php": "^5.5.9|>=7.0.8", + "symfony/http-kernel": "~2.8|~3.0|~4.0" + }, + "conflict": { + "symfony/http-foundation": "<3.3" + }, + "require-dev": { + "symfony/console": "~2.8|~3.0|~4.0", + "symfony/event-dispatcher": "~2.8|~3.0|~4.0", + "symfony/security-core": "~2.8|~3.0|~4.0", + "symfony/var-dumper": "~3.3|~4.0" + }, + "suggest": { + "symfony/console": "For the possibility to show log messages in console commands depending on verbosity settings. You need version ~2.3 of the console for it.", + "symfony/event-dispatcher": "Needed when using log messages in console commands.", + "symfony/http-kernel": "For using the debugging handlers together with the response life cycle of the HTTP kernel.", + "symfony/var-dumper": "For using the debugging handlers like the console handler or the log server handler." + }, + "type": "symfony-bridge", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Bridge\\Monolog\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Monolog Bridge", + "homepage": "https://symfony.com", + "time": "2018-01-03T07:37:34+00:00" + }, + { + "name": "symfony/monolog-bundle", + "version": "v2.12.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/monolog-bundle.git", + "reference": "b0146bdca7ba2a65f3bbe7010423c7393b29ec3f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/monolog-bundle/zipball/b0146bdca7ba2a65f3bbe7010423c7393b29ec3f", + "reference": "b0146bdca7ba2a65f3bbe7010423c7393b29ec3f", + "shasum": "" + }, + "require": { + "monolog/monolog": "~1.18", + "php": ">=5.3.2", + "symfony/config": "~2.3|~3.0", + "symfony/dependency-injection": "~2.3|~3.0", + "symfony/http-kernel": "~2.3|~3.0", + "symfony/monolog-bridge": "~2.3|~3.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8", + "symfony/console": "~2.3|~3.0", + "symfony/yaml": "~2.3|~3.0" + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Bundle\\MonologBundle\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Symfony MonologBundle", + "homepage": "http://symfony.com", + "keywords": [ + "log", + "logging" + ], + "time": "2017-01-02T19:04:26+00:00" + }, + { + "name": "symfony/polyfill-apcu", + "version": "v1.6.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-apcu.git", + "reference": "04f62674339602def515bff4bc6901fc1d4951e8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-apcu/zipball/04f62674339602def515bff4bc6901fc1d4951e8", + "reference": "04f62674339602def515bff4bc6901fc1d4951e8", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Apcu\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting apcu_* functions to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "apcu", + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2017-10-11T12:05:26+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.6.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", + "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2017-10-11T12:05:26+00:00" + }, + { + "name": "symfony/polyfill-php70", + "version": "v1.6.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php70.git", + "reference": "0442b9c0596610bd24ae7b5f0a6cdbbc16d9fcff" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/0442b9c0596610bd24ae7b5f0a6cdbbc16d9fcff", + "reference": "0442b9c0596610bd24ae7b5f0a6cdbbc16d9fcff", + "shasum": "" + }, + "require": { + "paragonie/random_compat": "~1.0|~2.0", + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php70\\": "" + }, + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2017-10-11T12:05:26+00:00" + }, + { + "name": "symfony/process", + "version": "v3.4.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "ff69f110c6b33fd33cd2089ba97d6112f44ef0ba" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/ff69f110c6b33fd33cd2089ba97d6112f44ef0ba", + "reference": "ff69f110c6b33fd33cd2089ba97d6112f44ef0ba", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Process\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Process Component", + "homepage": "https://symfony.com", + "time": "2018-01-03T07:37:34+00:00" + }, + { + "name": "symfony/routing", + "version": "v3.4.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/routing.git", + "reference": "e2b6d6fe7b090c7af720b75c7722c6dfa7a52658" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/routing/zipball/e2b6d6fe7b090c7af720b75c7722c6dfa7a52658", + "reference": "e2b6d6fe7b090c7af720b75c7722c6dfa7a52658", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "conflict": { + "symfony/config": "<2.8", + "symfony/dependency-injection": "<3.3", + "symfony/yaml": "<3.4" + }, + "require-dev": { + "doctrine/annotations": "~1.0", + "doctrine/common": "~2.2", + "psr/log": "~1.0", + "symfony/config": "~2.8|~3.0|~4.0", + "symfony/dependency-injection": "~3.3|~4.0", + "symfony/expression-language": "~2.8|~3.0|~4.0", + "symfony/http-foundation": "~2.8|~3.0|~4.0", + "symfony/yaml": "~3.4|~4.0" + }, + "suggest": { + "doctrine/annotations": "For using the annotation loader", + "symfony/config": "For using the all-in-one router or any loader", + "symfony/dependency-injection": "For loading routes from a service", + "symfony/expression-language": "For using expression matching", + "symfony/http-foundation": "For using a Symfony Request object", + "symfony/yaml": "For using the YAML loader" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Routing\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Routing Component", + "homepage": "https://symfony.com", + "keywords": [ + "router", + "routing", + "uri", + "url" + ], + "time": "2018-01-04T15:09:34+00:00" + }, + { + "name": "symfony/yaml", + "version": "v3.4.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "25c192f25721a74084272671f658797d9e0e0146" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/25c192f25721a74084272671f658797d9e0e0146", + "reference": "25c192f25721a74084272671f658797d9e0e0146", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "conflict": { + "symfony/console": "<3.4" + }, + "require-dev": { + "symfony/console": "~3.4|~4.0" + }, + "suggest": { + "symfony/console": "For validating YAML files using the lint command" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Yaml\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Yaml Component", + "homepage": "https://symfony.com", + "time": "2018-01-03T07:37:34+00:00" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": "^5.5.9|>=7.0.8" + }, + "platform-dev": [], + "platform-overrides": { + "php": "5.5.9" + } +} diff --git a/symfony-3.4-micro/phpunit.xml.dist b/symfony-3.4-micro/phpunit.xml.dist new file mode 100644 index 000000000..b115bb395 --- /dev/null +++ b/symfony-3.4-micro/phpunit.xml.dist @@ -0,0 +1,31 @@ + + + + + + + + + + + + tests + + + + + + src + + src/*Bundle/Resources + src/*/*Bundle/Resources + src/*/Bundle/*Bundle/Resources + + + + diff --git a/symfony-3.4-micro/src/App/Controller/HelloController.php b/symfony-3.4-micro/src/App/Controller/HelloController.php new file mode 100644 index 000000000..e127625af --- /dev/null +++ b/symfony-3.4-micro/src/App/Controller/HelloController.php @@ -0,0 +1,17 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Users of PHP 5.2 should be able to run the requirements checks. + * This is why the file and all classes must be compatible with PHP 5.2+ + * (e.g. not using namespaces and closures). + * + * ************** CAUTION ************** + * + * DO NOT EDIT THIS FILE as it will be overridden by Composer as part of + * the installation/update process. The original file resides in the + * SensioDistributionBundle. + * + * ************** CAUTION ************** + */ + +/** + * Represents a single PHP requirement, e.g. an installed extension. + * It can be a mandatory requirement or an optional recommendation. + * There is a special subclass, named PhpIniRequirement, to check a php.ini configuration. + * + * @author Tobias Schultze + */ +class Requirement +{ + private $fulfilled; + private $testMessage; + private $helpText; + private $helpHtml; + private $optional; + + /** + * Constructor that initializes the requirement. + * + * @param bool $fulfilled Whether the requirement is fulfilled + * @param string $testMessage The message for testing the requirement + * @param string $helpHtml The help text formatted in HTML for resolving the problem + * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) + * @param bool $optional Whether this is only an optional recommendation not a mandatory requirement + */ + public function __construct($fulfilled, $testMessage, $helpHtml, $helpText = null, $optional = false) + { + $this->fulfilled = (bool) $fulfilled; + $this->testMessage = (string) $testMessage; + $this->helpHtml = (string) $helpHtml; + $this->helpText = null === $helpText ? strip_tags($this->helpHtml) : (string) $helpText; + $this->optional = (bool) $optional; + } + + /** + * Returns whether the requirement is fulfilled. + * + * @return bool true if fulfilled, otherwise false + */ + public function isFulfilled() + { + return $this->fulfilled; + } + + /** + * Returns the message for testing the requirement. + * + * @return string The test message + */ + public function getTestMessage() + { + return $this->testMessage; + } + + /** + * Returns the help text for resolving the problem. + * + * @return string The help text + */ + public function getHelpText() + { + return $this->helpText; + } + + /** + * Returns the help text formatted in HTML. + * + * @return string The HTML help + */ + public function getHelpHtml() + { + return $this->helpHtml; + } + + /** + * Returns whether this is only an optional recommendation and not a mandatory requirement. + * + * @return bool true if optional, false if mandatory + */ + public function isOptional() + { + return $this->optional; + } +} + +/** + * Represents a PHP requirement in form of a php.ini configuration. + * + * @author Tobias Schultze + */ +class PhpIniRequirement extends Requirement +{ + /** + * Constructor that initializes the requirement. + * + * @param string $cfgName The configuration name used for ini_get() + * @param bool|callback $evaluation Either a boolean indicating whether the configuration should evaluate to true or false, + * or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement + * @param bool $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false. + * This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin. + * Example: You require a config to be true but PHP later removes this config and defaults it to true internally. + * @param string|null $testMessage The message for testing the requirement (when null and $evaluation is a boolean a default message is derived) + * @param string|null $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a boolean a default help is derived) + * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) + * @param bool $optional Whether this is only an optional recommendation not a mandatory requirement + */ + public function __construct($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null, $optional = false) + { + $cfgValue = ini_get($cfgName); + + if (is_callable($evaluation)) { + if (null === $testMessage || null === $helpHtml) { + throw new InvalidArgumentException('You must provide the parameters testMessage and helpHtml for a callback evaluation.'); + } + + $fulfilled = call_user_func($evaluation, $cfgValue); + } else { + if (null === $testMessage) { + $testMessage = sprintf('%s %s be %s in php.ini', + $cfgName, + $optional ? 'should' : 'must', + $evaluation ? 'enabled' : 'disabled' + ); + } + + if (null === $helpHtml) { + $helpHtml = sprintf('Set %s to %s in php.ini*.', + $cfgName, + $evaluation ? 'on' : 'off' + ); + } + + $fulfilled = $evaluation == $cfgValue; + } + + parent::__construct($fulfilled || ($approveCfgAbsence && false === $cfgValue), $testMessage, $helpHtml, $helpText, $optional); + } +} + +/** + * A RequirementCollection represents a set of Requirement instances. + * + * @author Tobias Schultze + */ +class RequirementCollection implements IteratorAggregate +{ + /** + * @var Requirement[] + */ + private $requirements = array(); + + /** + * Gets the current RequirementCollection as an Iterator. + * + * @return Traversable A Traversable interface + */ + public function getIterator() + { + return new ArrayIterator($this->requirements); + } + + /** + * Adds a Requirement. + * + * @param Requirement $requirement A Requirement instance + */ + public function add(Requirement $requirement) + { + $this->requirements[] = $requirement; + } + + /** + * Adds a mandatory requirement. + * + * @param bool $fulfilled Whether the requirement is fulfilled + * @param string $testMessage The message for testing the requirement + * @param string $helpHtml The help text formatted in HTML for resolving the problem + * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) + */ + public function addRequirement($fulfilled, $testMessage, $helpHtml, $helpText = null) + { + $this->add(new Requirement($fulfilled, $testMessage, $helpHtml, $helpText, false)); + } + + /** + * Adds an optional recommendation. + * + * @param bool $fulfilled Whether the recommendation is fulfilled + * @param string $testMessage The message for testing the recommendation + * @param string $helpHtml The help text formatted in HTML for resolving the problem + * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) + */ + public function addRecommendation($fulfilled, $testMessage, $helpHtml, $helpText = null) + { + $this->add(new Requirement($fulfilled, $testMessage, $helpHtml, $helpText, true)); + } + + /** + * Adds a mandatory requirement in form of a php.ini configuration. + * + * @param string $cfgName The configuration name used for ini_get() + * @param bool|callback $evaluation Either a boolean indicating whether the configuration should evaluate to true or false, + * or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement + * @param bool $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false. + * This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin. + * Example: You require a config to be true but PHP later removes this config and defaults it to true internally. + * @param string $testMessage The message for testing the requirement (when null and $evaluation is a boolean a default message is derived) + * @param string $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a boolean a default help is derived) + * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) + */ + public function addPhpIniRequirement($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null) + { + $this->add(new PhpIniRequirement($cfgName, $evaluation, $approveCfgAbsence, $testMessage, $helpHtml, $helpText, false)); + } + + /** + * Adds an optional recommendation in form of a php.ini configuration. + * + * @param string $cfgName The configuration name used for ini_get() + * @param bool|callback $evaluation Either a boolean indicating whether the configuration should evaluate to true or false, + * or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement + * @param bool $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false. + * This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin. + * Example: You require a config to be true but PHP later removes this config and defaults it to true internally. + * @param string $testMessage The message for testing the requirement (when null and $evaluation is a boolean a default message is derived) + * @param string $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a boolean a default help is derived) + * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) + */ + public function addPhpIniRecommendation($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null) + { + $this->add(new PhpIniRequirement($cfgName, $evaluation, $approveCfgAbsence, $testMessage, $helpHtml, $helpText, true)); + } + + /** + * Adds a requirement collection to the current set of requirements. + * + * @param RequirementCollection $collection A RequirementCollection instance + */ + public function addCollection(RequirementCollection $collection) + { + $this->requirements = array_merge($this->requirements, $collection->all()); + } + + /** + * Returns both requirements and recommendations. + * + * @return Requirement[] + */ + public function all() + { + return $this->requirements; + } + + /** + * Returns all mandatory requirements. + * + * @return Requirement[] + */ + public function getRequirements() + { + $array = array(); + foreach ($this->requirements as $req) { + if (!$req->isOptional()) { + $array[] = $req; + } + } + + return $array; + } + + /** + * Returns the mandatory requirements that were not met. + * + * @return Requirement[] + */ + public function getFailedRequirements() + { + $array = array(); + foreach ($this->requirements as $req) { + if (!$req->isFulfilled() && !$req->isOptional()) { + $array[] = $req; + } + } + + return $array; + } + + /** + * Returns all optional recommendations. + * + * @return Requirement[] + */ + public function getRecommendations() + { + $array = array(); + foreach ($this->requirements as $req) { + if ($req->isOptional()) { + $array[] = $req; + } + } + + return $array; + } + + /** + * Returns the recommendations that were not met. + * + * @return Requirement[] + */ + public function getFailedRecommendations() + { + $array = array(); + foreach ($this->requirements as $req) { + if (!$req->isFulfilled() && $req->isOptional()) { + $array[] = $req; + } + } + + return $array; + } + + /** + * Returns whether a php.ini configuration is not correct. + * + * @return bool php.ini configuration problem? + */ + public function hasPhpIniConfigIssue() + { + foreach ($this->requirements as $req) { + if (!$req->isFulfilled() && $req instanceof PhpIniRequirement) { + return true; + } + } + + return false; + } + + /** + * Returns the PHP configuration file (php.ini) path. + * + * @return string|false php.ini file path + */ + public function getPhpIniConfigPath() + { + return get_cfg_var('cfg_file_path'); + } +} + +/** + * This class specifies all requirements and optional recommendations that + * are necessary to run the Symfony Standard Edition. + * + * @author Tobias Schultze + * @author Fabien Potencier + */ +class SymfonyRequirements extends RequirementCollection +{ + const LEGACY_REQUIRED_PHP_VERSION = '5.3.3'; + const REQUIRED_PHP_VERSION = '5.5.9'; + + /** + * Constructor that initializes the requirements. + */ + public function __construct() + { + /* mandatory requirements follow */ + + $installedPhpVersion = phpversion(); + $requiredPhpVersion = $this->getPhpRequiredVersion(); + + $this->addRecommendation( + $requiredPhpVersion, + 'Vendors should be installed in order to check all requirements.', + 'Run the composer install command.', + 'Run the "composer install" command.' + ); + + if (false !== $requiredPhpVersion) { + $this->addRequirement( + version_compare($installedPhpVersion, $requiredPhpVersion, '>='), + sprintf('PHP version must be at least %s (%s installed)', $requiredPhpVersion, $installedPhpVersion), + sprintf('You are running PHP version "%s", but Symfony needs at least PHP "%s" to run. + Before using Symfony, upgrade your PHP installation, preferably to the latest version.', + $installedPhpVersion, $requiredPhpVersion), + sprintf('Install PHP %s or newer (installed version is %s)', $requiredPhpVersion, $installedPhpVersion) + ); + } + + $this->addRequirement( + version_compare($installedPhpVersion, '5.3.16', '!='), + 'PHP version must not be 5.3.16 as Symfony won\'t work properly with it', + 'Install PHP 5.3.17 or newer (or downgrade to an earlier PHP version)' + ); + + $this->addRequirement( + is_dir(__DIR__.'/../vendor/composer'), + 'Vendor libraries must be installed', + 'Vendor libraries are missing. Install composer following instructions from http://getcomposer.org/. '. + 'Then run "php composer.phar install" to install them.' + ); + + $cacheDir = is_dir(__DIR__.'/../var/cache') ? __DIR__.'/../var/cache' : __DIR__.'/cache'; + + $this->addRequirement( + is_writable($cacheDir), + 'app/cache/ or var/cache/ directory must be writable', + 'Change the permissions of either "app/cache/" or "var/cache/" directory so that the web server can write into it.' + ); + + $logsDir = is_dir(__DIR__.'/../var/logs') ? __DIR__.'/../var/logs' : __DIR__.'/logs'; + + $this->addRequirement( + is_writable($logsDir), + 'app/logs/ or var/logs/ directory must be writable', + 'Change the permissions of either "app/logs/" or "var/logs/" directory so that the web server can write into it.' + ); + + if (version_compare($installedPhpVersion, '7.0.0', '<')) { + $this->addPhpIniRequirement( + 'date.timezone', true, false, + 'date.timezone setting must be set', + 'Set the "date.timezone" setting in php.ini* (like Europe/Paris).' + ); + } + + if (false !== $requiredPhpVersion && version_compare($installedPhpVersion, $requiredPhpVersion, '>=')) { + $timezones = array(); + foreach (DateTimeZone::listAbbreviations() as $abbreviations) { + foreach ($abbreviations as $abbreviation) { + $timezones[$abbreviation['timezone_id']] = true; + } + } + + $this->addRequirement( + isset($timezones[@date_default_timezone_get()]), + sprintf('Configured default timezone "%s" must be supported by your installation of PHP', @date_default_timezone_get()), + 'Your default timezone is not supported by PHP. Check for typos in your php.ini file and have a look at the list of deprecated timezones at http://php.net/manual/en/timezones.others.php.' + ); + } + + $this->addRequirement( + function_exists('iconv'), + 'iconv() must be available', + 'Install and enable the iconv extension.' + ); + + $this->addRequirement( + function_exists('json_encode'), + 'json_encode() must be available', + 'Install and enable the JSON extension.' + ); + + $this->addRequirement( + function_exists('session_start'), + 'session_start() must be available', + 'Install and enable the session extension.' + ); + + $this->addRequirement( + function_exists('ctype_alpha'), + 'ctype_alpha() must be available', + 'Install and enable the ctype extension.' + ); + + $this->addRequirement( + function_exists('token_get_all'), + 'token_get_all() must be available', + 'Install and enable the Tokenizer extension.' + ); + + $this->addRequirement( + function_exists('simplexml_import_dom'), + 'simplexml_import_dom() must be available', + 'Install and enable the SimpleXML extension.' + ); + + if (function_exists('apc_store') && ini_get('apc.enabled')) { + if (version_compare($installedPhpVersion, '5.4.0', '>=')) { + $this->addRequirement( + version_compare(phpversion('apc'), '3.1.13', '>='), + 'APC version must be at least 3.1.13 when using PHP 5.4', + 'Upgrade your APC extension (3.1.13+).' + ); + } else { + $this->addRequirement( + version_compare(phpversion('apc'), '3.0.17', '>='), + 'APC version must be at least 3.0.17', + 'Upgrade your APC extension (3.0.17+).' + ); + } + } + + $this->addPhpIniRequirement('detect_unicode', false); + + if (extension_loaded('suhosin')) { + $this->addPhpIniRequirement( + 'suhosin.executor.include.whitelist', + create_function('$cfgValue', 'return false !== stripos($cfgValue, "phar");'), + false, + 'suhosin.executor.include.whitelist must be configured correctly in php.ini', + 'Add "phar" to suhosin.executor.include.whitelist in php.ini*.' + ); + } + + if (extension_loaded('xdebug')) { + $this->addPhpIniRequirement( + 'xdebug.show_exception_trace', false, true + ); + + $this->addPhpIniRequirement( + 'xdebug.scream', false, true + ); + + $this->addPhpIniRecommendation( + 'xdebug.max_nesting_level', + create_function('$cfgValue', 'return $cfgValue > 100;'), + true, + 'xdebug.max_nesting_level should be above 100 in php.ini', + 'Set "xdebug.max_nesting_level" to e.g. "250" in php.ini* to stop Xdebug\'s infinite recursion protection erroneously throwing a fatal error in your project.' + ); + } + + $pcreVersion = defined('PCRE_VERSION') ? (float) PCRE_VERSION : null; + + $this->addRequirement( + null !== $pcreVersion, + 'PCRE extension must be available', + 'Install the PCRE extension (version 8.0+).' + ); + + if (extension_loaded('mbstring')) { + $this->addPhpIniRequirement( + 'mbstring.func_overload', + create_function('$cfgValue', 'return (int) $cfgValue === 0;'), + true, + 'string functions should not be overloaded', + 'Set "mbstring.func_overload" to 0 in php.ini* to disable function overloading by the mbstring extension.' + ); + } + + /* optional recommendations follow */ + + if (file_exists(__DIR__.'/../vendor/composer')) { + require_once __DIR__.'/../vendor/autoload.php'; + + try { + $r = new ReflectionClass('Sensio\Bundle\DistributionBundle\SensioDistributionBundle'); + + $contents = file_get_contents(dirname($r->getFileName()).'/Resources/skeleton/app/SymfonyRequirements.php'); + } catch (ReflectionException $e) { + $contents = ''; + } + $this->addRecommendation( + file_get_contents(__FILE__) === $contents, + 'Requirements file should be up-to-date', + 'Your requirements file is outdated. Run composer install and re-check your configuration.' + ); + } + + $this->addRecommendation( + version_compare($installedPhpVersion, '5.3.4', '>='), + 'You should use at least PHP 5.3.4 due to PHP bug #52083 in earlier versions', + 'Your project might malfunction randomly due to PHP bug #52083 ("Notice: Trying to get property of non-object"). Install PHP 5.3.4 or newer.' + ); + + $this->addRecommendation( + version_compare($installedPhpVersion, '5.3.8', '>='), + 'When using annotations you should have at least PHP 5.3.8 due to PHP bug #55156', + 'Install PHP 5.3.8 or newer if your project uses annotations.' + ); + + $this->addRecommendation( + version_compare($installedPhpVersion, '5.4.0', '!='), + 'You should not use PHP 5.4.0 due to the PHP bug #61453', + 'Your project might not work properly due to the PHP bug #61453 ("Cannot dump definitions which have method calls"). Install PHP 5.4.1 or newer.' + ); + + $this->addRecommendation( + version_compare($installedPhpVersion, '5.4.11', '>='), + 'When using the logout handler from the Symfony Security Component, you should have at least PHP 5.4.11 due to PHP bug #63379 (as a workaround, you can also set invalidate_session to false in the security logout handler configuration)', + 'Install PHP 5.4.11 or newer if your project uses the logout handler from the Symfony Security Component.' + ); + + $this->addRecommendation( + (version_compare($installedPhpVersion, '5.3.18', '>=') && version_compare($installedPhpVersion, '5.4.0', '<')) + || + version_compare($installedPhpVersion, '5.4.8', '>='), + 'You should use PHP 5.3.18+ or PHP 5.4.8+ to always get nice error messages for fatal errors in the development environment due to PHP bug #61767/#60909', + 'Install PHP 5.3.18+ or PHP 5.4.8+ if you want nice error messages for all fatal errors in the development environment.' + ); + + if (null !== $pcreVersion) { + $this->addRecommendation( + $pcreVersion >= 8.0, + sprintf('PCRE extension should be at least version 8.0 (%s installed)', $pcreVersion), + 'PCRE 8.0+ is preconfigured in PHP since 5.3.2 but you are using an outdated version of it. Symfony probably works anyway but it is recommended to upgrade your PCRE extension.' + ); + } + + $this->addRecommendation( + class_exists('DomDocument'), + 'PHP-DOM and PHP-XML modules should be installed', + 'Install and enable the PHP-DOM and the PHP-XML modules.' + ); + + $this->addRecommendation( + function_exists('mb_strlen'), + 'mb_strlen() should be available', + 'Install and enable the mbstring extension.' + ); + + $this->addRecommendation( + function_exists('utf8_decode'), + 'utf8_decode() should be available', + 'Install and enable the XML extension.' + ); + + $this->addRecommendation( + function_exists('filter_var'), + 'filter_var() should be available', + 'Install and enable the filter extension.' + ); + + if (!defined('PHP_WINDOWS_VERSION_BUILD')) { + $this->addRecommendation( + function_exists('posix_isatty'), + 'posix_isatty() should be available', + 'Install and enable the php_posix extension (used to colorize the CLI output).' + ); + } + + $this->addRecommendation( + extension_loaded('intl'), + 'intl extension should be available', + 'Install and enable the intl extension (used for validators).' + ); + + if (extension_loaded('intl')) { + // in some WAMP server installations, new Collator() returns null + $this->addRecommendation( + null !== new Collator('fr_FR'), + 'intl extension should be correctly configured', + 'The intl extension does not behave properly. This problem is typical on PHP 5.3.X x64 WIN builds.' + ); + + // check for compatible ICU versions (only done when you have the intl extension) + if (defined('INTL_ICU_VERSION')) { + $version = INTL_ICU_VERSION; + } else { + $reflector = new ReflectionExtension('intl'); + + ob_start(); + $reflector->info(); + $output = strip_tags(ob_get_clean()); + + preg_match('/^ICU version +(?:=> )?(.*)$/m', $output, $matches); + $version = $matches[1]; + } + + $this->addRecommendation( + version_compare($version, '4.0', '>='), + 'intl ICU version should be at least 4+', + 'Upgrade your intl extension with a newer ICU version (4+).' + ); + + if (class_exists('Symfony\Component\Intl\Intl')) { + $this->addRecommendation( + \Symfony\Component\Intl\Intl::getIcuDataVersion() <= \Symfony\Component\Intl\Intl::getIcuVersion(), + sprintf('intl ICU version installed on your system is outdated (%s) and does not match the ICU data bundled with Symfony (%s)', \Symfony\Component\Intl\Intl::getIcuVersion(), \Symfony\Component\Intl\Intl::getIcuDataVersion()), + 'To get the latest internationalization data upgrade the ICU system package and the intl PHP extension.' + ); + if (\Symfony\Component\Intl\Intl::getIcuDataVersion() <= \Symfony\Component\Intl\Intl::getIcuVersion()) { + $this->addRecommendation( + \Symfony\Component\Intl\Intl::getIcuDataVersion() === \Symfony\Component\Intl\Intl::getIcuVersion(), + sprintf('intl ICU version installed on your system (%s) does not match the ICU data bundled with Symfony (%s)', \Symfony\Component\Intl\Intl::getIcuVersion(), \Symfony\Component\Intl\Intl::getIcuDataVersion()), + 'To avoid internationalization data inconsistencies upgrade the symfony/intl component.' + ); + } + } + + $this->addPhpIniRecommendation( + 'intl.error_level', + create_function('$cfgValue', 'return (int) $cfgValue === 0;'), + true, + 'intl.error_level should be 0 in php.ini', + 'Set "intl.error_level" to "0" in php.ini* to inhibit the messages when an error occurs in ICU functions.' + ); + } + + $accelerator = + (extension_loaded('eaccelerator') && ini_get('eaccelerator.enable')) + || + (extension_loaded('apc') && ini_get('apc.enabled')) + || + (extension_loaded('Zend Optimizer+') && ini_get('zend_optimizerplus.enable')) + || + (extension_loaded('Zend OPcache') && ini_get('opcache.enable')) + || + (extension_loaded('xcache') && ini_get('xcache.cacher')) + || + (extension_loaded('wincache') && ini_get('wincache.ocenabled')) + ; + + $this->addRecommendation( + $accelerator, + 'a PHP accelerator should be installed', + 'Install and/or enable a PHP accelerator (highly recommended).' + ); + + if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { + $this->addRecommendation( + $this->getRealpathCacheSize() >= 5 * 1024 * 1024, + 'realpath_cache_size should be at least 5M in php.ini', + 'Setting "realpath_cache_size" to e.g. "5242880" or "5M" in php.ini* may improve performance on Windows significantly in some cases.' + ); + } + + $this->addPhpIniRecommendation('short_open_tag', false); + + $this->addPhpIniRecommendation('magic_quotes_gpc', false, true); + + $this->addPhpIniRecommendation('register_globals', false, true); + + $this->addPhpIniRecommendation('session.auto_start', false); + + $this->addRecommendation( + class_exists('PDO'), + 'PDO should be installed', + 'Install PDO (mandatory for Doctrine).' + ); + + if (class_exists('PDO')) { + $drivers = PDO::getAvailableDrivers(); + $this->addRecommendation( + count($drivers) > 0, + sprintf('PDO should have some drivers installed (currently available: %s)', count($drivers) ? implode(', ', $drivers) : 'none'), + 'Install PDO drivers (mandatory for Doctrine).' + ); + } + } + + /** + * Loads realpath_cache_size from php.ini and converts it to int. + * + * (e.g. 16k is converted to 16384 int) + * + * @return int + */ + protected function getRealpathCacheSize() + { + $size = ini_get('realpath_cache_size'); + $size = trim($size); + $unit = ''; + if (!ctype_digit($size)) { + $unit = strtolower(substr($size, -1, 1)); + $size = (int) substr($size, 0, -1); + } + switch ($unit) { + case 'g': + return $size * 1024 * 1024 * 1024; + case 'm': + return $size * 1024 * 1024; + case 'k': + return $size * 1024; + default: + return (int) $size; + } + } + + /** + * Defines PHP required version from Symfony version. + * + * @return string|false The PHP required version or false if it could not be guessed + */ + protected function getPhpRequiredVersion() + { + if (!file_exists($path = __DIR__.'/../composer.lock')) { + return false; + } + + $composerLock = json_decode(file_get_contents($path), true); + foreach ($composerLock['packages'] as $package) { + $name = $package['name']; + if ('symfony/symfony' !== $name && 'symfony/http-kernel' !== $name) { + continue; + } + + return (int) $package['version'][1] > 2 ? self::REQUIRED_PHP_VERSION : self::LEGACY_REQUIRED_PHP_VERSION; + } + + return false; + } +} diff --git a/symfony-3.4-micro/var/cache/.gitkeep b/symfony-3.4-micro/var/cache/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/symfony-3.4-micro/var/logs/.gitkeep b/symfony-3.4-micro/var/logs/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/symfony-3.4-micro/var/sessions/.gitkeep b/symfony-3.4-micro/var/sessions/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/symfony-3.4-micro/web/micro.php b/symfony-3.4-micro/web/micro.php new file mode 100644 index 000000000..37af6654d --- /dev/null +++ b/symfony-3.4-micro/web/micro.php @@ -0,0 +1,19 @@ +loadClassCache(); + +$request = Request::createFromGlobals(); +$response = $kernel->handle($request); +$response->send(); +$kernel->terminate($request, $response); + +require __DIR__ . '/../../libs/output_data.php'; diff --git a/symfony-3.4/.gitignore b/symfony-3.4/.gitignore new file mode 100644 index 000000000..93821ad1c --- /dev/null +++ b/symfony-3.4/.gitignore @@ -0,0 +1,16 @@ +/app/config/parameters.yml +/build/ +/phpunit.xml +/var/* +!/var/cache +/var/cache/* +!var/cache/.gitkeep +!/var/logs +/var/logs/* +!var/logs/.gitkeep +!/var/sessions +/var/sessions/* +!var/sessions/.gitkeep +!var/SymfonyRequirements.php +/vendor/ +/web/bundles/ diff --git a/symfony-3.4/README.md b/symfony-3.4/README.md new file mode 100644 index 000000000..44895903c --- /dev/null +++ b/symfony-3.4/README.md @@ -0,0 +1,4 @@ +symfony-3.4 +=========== + +A Symfony project diff --git a/symfony-3.4/_benchmark/hello_world.sh b/symfony-3.4/_benchmark/hello_world.sh new file mode 100644 index 000000000..9e6369133 --- /dev/null +++ b/symfony-3.4/_benchmark/hello_world.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +url="$base/$fw/web/app.php/hello/index" diff --git a/symfony-3.4/_benchmark/setup.sh b/symfony-3.4/_benchmark/setup.sh new file mode 100644 index 000000000..0244cd4d5 --- /dev/null +++ b/symfony-3.4/_benchmark/setup.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +export SYMFONY_ENV=prod +composer install --no-dev --optimize-autoloader +php bin/console cache:clear --env=prod --no-debug --no-warmup +php bin/console cache:warmup --env=prod --no-debug +chmod o+w var/cache/ var/logs/ +chmod -R o+w var/cache/* diff --git a/symfony-3.4/app/AppCache.php b/symfony-3.4/app/AppCache.php new file mode 100644 index 000000000..639ec2cd7 --- /dev/null +++ b/symfony-3.4/app/AppCache.php @@ -0,0 +1,7 @@ +getEnvironment(), ['dev', 'test'], true)) { + $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle(); + $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle(); + $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle(); + $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle(); + } + + return $bundles; + } + + public function getRootDir() + { + return __DIR__; + } + + public function getCacheDir() + { + return dirname(__DIR__).'/var/cache/'.$this->getEnvironment(); + } + + public function getLogDir() + { + return dirname(__DIR__).'/var/logs'; + } + + public function registerContainerConfiguration(LoaderInterface $loader) + { + $loader->load($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml'); + } +} diff --git a/symfony-3.4/app/Resources/views/base.html.twig b/symfony-3.4/app/Resources/views/base.html.twig new file mode 100644 index 000000000..bafd28d3b --- /dev/null +++ b/symfony-3.4/app/Resources/views/base.html.twig @@ -0,0 +1,13 @@ + + + + + {% block title %}Welcome!{% endblock %} + {% block stylesheets %}{% endblock %} + + + + {% block body %}{% endblock %} + {% block javascripts %}{% endblock %} + + diff --git a/symfony-3.4/app/Resources/views/default/index.html.twig b/symfony-3.4/app/Resources/views/default/index.html.twig new file mode 100644 index 000000000..7319df7f8 --- /dev/null +++ b/symfony-3.4/app/Resources/views/default/index.html.twig @@ -0,0 +1,76 @@ +{% extends 'base.html.twig' %} + +{% block body %} +
+
+
+

Welcome to Symfony {{ constant('Symfony\\Component\\HttpKernel\\Kernel::VERSION') }}

+
+ +
+

+ + + Your application is now ready. You can start working on it at: + {{ base_dir }}/ +

+
+ + + +
+
+{% endblock %} + +{% block stylesheets %} + +{% endblock %} diff --git a/symfony-3.4/app/autoload.php b/symfony-3.4/app/autoload.php new file mode 100644 index 000000000..fa582ecd0 --- /dev/null +++ b/symfony-3.4/app/autoload.php @@ -0,0 +1,13 @@ +getParameterOption(['--env', '-e'], getenv('SYMFONY_ENV') ?: 'dev'); +$debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(['--no-debug', '']) && $env !== 'prod'; + +if ($debug) { + Debug::enable(); +} + +$kernel = new AppKernel($env, $debug); +$application = new Application($kernel); +$application->run($input); diff --git a/symfony-3.4/bin/symfony_requirements b/symfony-3.4/bin/symfony_requirements new file mode 100755 index 000000000..a7bf65a1b --- /dev/null +++ b/symfony-3.4/bin/symfony_requirements @@ -0,0 +1,146 @@ +#!/usr/bin/env php +getPhpIniConfigPath(); + +echo_title('Symfony Requirements Checker'); + +echo '> PHP is using the following php.ini file:'.PHP_EOL; +if ($iniPath) { + echo_style('green', ' '.$iniPath); +} else { + echo_style('yellow', ' WARNING: No configuration file (php.ini) used by PHP!'); +} + +echo PHP_EOL.PHP_EOL; + +echo '> Checking Symfony requirements:'.PHP_EOL.' '; + +$messages = array(); +foreach ($symfonyRequirements->getRequirements() as $req) { + if ($helpText = get_error_message($req, $lineSize)) { + echo_style('red', 'E'); + $messages['error'][] = $helpText; + } else { + echo_style('green', '.'); + } +} + +$checkPassed = empty($messages['error']); + +foreach ($symfonyRequirements->getRecommendations() as $req) { + if ($helpText = get_error_message($req, $lineSize)) { + echo_style('yellow', 'W'); + $messages['warning'][] = $helpText; + } else { + echo_style('green', '.'); + } +} + +if ($checkPassed) { + echo_block('success', 'OK', 'Your system is ready to run Symfony projects'); +} else { + echo_block('error', 'ERROR', 'Your system is not ready to run Symfony projects'); + + echo_title('Fix the following mandatory requirements', 'red'); + + foreach ($messages['error'] as $helpText) { + echo ' * '.$helpText.PHP_EOL; + } +} + +if (!empty($messages['warning'])) { + echo_title('Optional recommendations to improve your setup', 'yellow'); + + foreach ($messages['warning'] as $helpText) { + echo ' * '.$helpText.PHP_EOL; + } +} + +echo PHP_EOL; +echo_style('title', 'Note'); +echo ' The command console could use a different php.ini file'.PHP_EOL; +echo_style('title', '~~~~'); +echo ' than the one used with your web server. To be on the'.PHP_EOL; +echo ' safe side, please check the requirements from your web'.PHP_EOL; +echo ' server using the '; +echo_style('yellow', 'web/config.php'); +echo ' script.'.PHP_EOL; +echo PHP_EOL; + +exit($checkPassed ? 0 : 1); + +function get_error_message(Requirement $requirement, $lineSize) +{ + if ($requirement->isFulfilled()) { + return; + } + + $errorMessage = wordwrap($requirement->getTestMessage(), $lineSize - 3, PHP_EOL.' ').PHP_EOL; + $errorMessage .= ' > '.wordwrap($requirement->getHelpText(), $lineSize - 5, PHP_EOL.' > ').PHP_EOL; + + return $errorMessage; +} + +function echo_title($title, $style = null) +{ + $style = $style ?: 'title'; + + echo PHP_EOL; + echo_style($style, $title.PHP_EOL); + echo_style($style, str_repeat('~', strlen($title)).PHP_EOL); + echo PHP_EOL; +} + +function echo_style($style, $message) +{ + // ANSI color codes + $styles = array( + 'reset' => "\033[0m", + 'red' => "\033[31m", + 'green' => "\033[32m", + 'yellow' => "\033[33m", + 'error' => "\033[37;41m", + 'success' => "\033[37;42m", + 'title' => "\033[34m", + ); + $supports = has_color_support(); + + echo($supports ? $styles[$style] : '').$message.($supports ? $styles['reset'] : ''); +} + +function echo_block($style, $title, $message) +{ + $message = ' '.trim($message).' '; + $width = strlen($message); + + echo PHP_EOL.PHP_EOL; + + echo_style($style, str_repeat(' ', $width)); + echo PHP_EOL; + echo_style($style, str_pad(' ['.$title.']', $width, ' ', STR_PAD_RIGHT)); + echo PHP_EOL; + echo_style($style, $message); + echo PHP_EOL; + echo_style($style, str_repeat(' ', $width)); + echo PHP_EOL; +} + +function has_color_support() +{ + static $support; + + if (null === $support) { + if (DIRECTORY_SEPARATOR == '\\') { + $support = false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI'); + } else { + $support = function_exists('posix_isatty') && @posix_isatty(STDOUT); + } + } + + return $support; +} diff --git a/symfony-3.4/composer.json b/symfony-3.4/composer.json new file mode 100644 index 000000000..a6f63491f --- /dev/null +++ b/symfony-3.4/composer.json @@ -0,0 +1,69 @@ +{ + "name": "kenji/symfony.3.4", + "license": "proprietary", + "type": "project", + "autoload": { + "psr-4": { + "": "src/" + }, + "classmap": [ + "app/AppKernel.php", + "app/AppCache.php" + ] + }, + "autoload-dev": { + "psr-4": { + "Tests\\": "tests/" + } + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "symfony/symfony": "3.4.*", + "doctrine/orm": "^2.5", + "doctrine/doctrine-bundle": "^1.6", + "doctrine/doctrine-cache-bundle": "^1.2", + "symfony/swiftmailer-bundle": "^2.3", + "symfony/monolog-bundle": "^2.8", + "sensio/distribution-bundle": "^5.0", + "sensio/framework-extra-bundle": "^3.0.2", + "incenteev/composer-parameter-handler": "^2.0" + }, + "require-dev": { + "sensio/generator-bundle": "^3.0", + "symfony/phpunit-bridge": "^3.0" + }, + "scripts": { + "post-install-cmd": [ + "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters", + "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap", + "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache", + "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets", + "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile", + "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget" + ], + "post-update-cmd": [ + "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters", + "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap", + "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache", + "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets", + "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile", + "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget" + ] + }, + "config": { + "platform": { + "php": "5.5.9" + } + }, + "extra": { + "symfony-app-dir": "app", + "symfony-bin-dir": "bin", + "symfony-var-dir": "var", + "symfony-web-dir": "web", + "symfony-tests-dir": "tests", + "symfony-assets-install": "relative", + "incenteev-parameters": { + "file": "app/config/parameters.yml" + } + } +} diff --git a/symfony-3.4/composer.lock b/symfony-3.4/composer.lock new file mode 100644 index 000000000..0a97ee23b --- /dev/null +++ b/symfony-3.4/composer.lock @@ -0,0 +1,2392 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "content-hash": "cab3e704043ea1ba4c17dd1c93524f32", + "packages": [ + { + "name": "composer/ca-bundle", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/composer/ca-bundle.git", + "reference": "943b2c4fcad1ef178d16a713c2468bf7e579c288" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/ca-bundle/zipball/943b2c4fcad1ef178d16a713c2468bf7e579c288", + "reference": "943b2c4fcad1ef178d16a713c2468bf7e579c288", + "shasum": "" + }, + "require": { + "ext-openssl": "*", + "ext-pcre": "*", + "php": "^5.3.2 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35", + "psr/log": "^1.0", + "symfony/process": "^2.5 || ^3.0 || ^4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\CaBundle\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.", + "keywords": [ + "cabundle", + "cacert", + "certificate", + "ssl", + "tls" + ], + "time": "2017-11-29T09:37:33+00:00" + }, + { + "name": "doctrine/annotations", + "version": "v1.2.7", + "source": { + "type": "git", + "url": "https://github.com/doctrine/annotations.git", + "reference": "f25c8aab83e0c3e976fd7d19875f198ccf2f7535" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/f25c8aab83e0c3e976fd7d19875f198ccf2f7535", + "reference": "f25c8aab83e0c3e976fd7d19875f198ccf2f7535", + "shasum": "" + }, + "require": { + "doctrine/lexer": "1.*", + "php": ">=5.3.2" + }, + "require-dev": { + "doctrine/cache": "1.*", + "phpunit/phpunit": "4.*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\Annotations\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Docblock Annotations Parser", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "annotations", + "docblock", + "parser" + ], + "time": "2015-08-31T12:32:49+00:00" + }, + { + "name": "doctrine/cache", + "version": "v1.6.2", + "source": { + "type": "git", + "url": "https://github.com/doctrine/cache.git", + "reference": "eb152c5100571c7a45470ff2a35095ab3f3b900b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/cache/zipball/eb152c5100571c7a45470ff2a35095ab3f3b900b", + "reference": "eb152c5100571c7a45470ff2a35095ab3f3b900b", + "shasum": "" + }, + "require": { + "php": "~5.5|~7.0" + }, + "conflict": { + "doctrine/common": ">2.2,<2.4" + }, + "require-dev": { + "phpunit/phpunit": "~4.8|~5.0", + "predis/predis": "~1.0", + "satooshi/php-coveralls": "~0.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Caching library offering an object-oriented API for many cache backends", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "cache", + "caching" + ], + "time": "2017-07-22T12:49:21+00:00" + }, + { + "name": "doctrine/collections", + "version": "v1.3.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/collections.git", + "reference": "6c1e4eef75f310ea1b3e30945e9f06e652128b8a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/collections/zipball/6c1e4eef75f310ea1b3e30945e9f06e652128b8a", + "reference": "6c1e4eef75f310ea1b3e30945e9f06e652128b8a", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\Collections\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Collections Abstraction library", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "array", + "collections", + "iterator" + ], + "time": "2015-04-14T22:21:58+00:00" + }, + { + "name": "doctrine/common", + "version": "v2.6.2", + "source": { + "type": "git", + "url": "https://github.com/doctrine/common.git", + "reference": "7bce00698899aa2c06fe7365c76e4d78ddb15fa3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/common/zipball/7bce00698899aa2c06fe7365c76e4d78ddb15fa3", + "reference": "7bce00698899aa2c06fe7365c76e4d78ddb15fa3", + "shasum": "" + }, + "require": { + "doctrine/annotations": "1.*", + "doctrine/cache": "1.*", + "doctrine/collections": "1.*", + "doctrine/inflector": "1.*", + "doctrine/lexer": "1.*", + "php": "~5.5|~7.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.8|~5.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.7.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\": "lib/Doctrine/Common" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Common Library for Doctrine projects", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "annotations", + "collections", + "eventmanager", + "persistence", + "spl" + ], + "time": "2016-11-30T16:50:46+00:00" + }, + { + "name": "doctrine/dbal", + "version": "v2.5.13", + "source": { + "type": "git", + "url": "https://github.com/doctrine/dbal.git", + "reference": "729340d8d1eec8f01bff708e12e449a3415af873" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/729340d8d1eec8f01bff708e12e449a3415af873", + "reference": "729340d8d1eec8f01bff708e12e449a3415af873", + "shasum": "" + }, + "require": { + "doctrine/common": ">=2.4,<2.8-dev", + "php": ">=5.3.2" + }, + "require-dev": { + "phpunit/phpunit": "4.*", + "symfony/console": "2.*||^3.0" + }, + "suggest": { + "symfony/console": "For helpful console commands such as SQL execution and import of files." + }, + "bin": [ + "bin/doctrine-dbal" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.5.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\DBAL\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + } + ], + "description": "Database Abstraction Layer", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "database", + "dbal", + "persistence", + "queryobject" + ], + "time": "2017-07-22T20:44:48+00:00" + }, + { + "name": "doctrine/doctrine-bundle", + "version": "1.8.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/DoctrineBundle.git", + "reference": "eb6e4fb904a459be28872765ab6e2d246aac7c87" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/DoctrineBundle/zipball/eb6e4fb904a459be28872765ab6e2d246aac7c87", + "reference": "eb6e4fb904a459be28872765ab6e2d246aac7c87", + "shasum": "" + }, + "require": { + "doctrine/dbal": "^2.5.12", + "doctrine/doctrine-cache-bundle": "~1.2", + "jdorn/sql-formatter": "^1.2.16", + "php": "^5.5.9|^7.0", + "symfony/console": "~2.7|~3.0|~4.0", + "symfony/dependency-injection": "~2.7|~3.0|~4.0", + "symfony/doctrine-bridge": "~2.7|~3.0|~4.0", + "symfony/framework-bundle": "~2.7|~3.0|~4.0" + }, + "conflict": { + "symfony/http-foundation": "<2.6" + }, + "require-dev": { + "doctrine/orm": "~2.3", + "phpunit/phpunit": "^4.8.36|^5.7|^6.4", + "satooshi/php-coveralls": "^1.0", + "symfony/phpunit-bridge": "~2.7|~3.0|~4.0", + "symfony/property-info": "~2.8|~3.0|~4.0", + "symfony/validator": "~2.7|~3.0|~4.0", + "symfony/web-profiler-bundle": "~2.7|~3.0|~4.0", + "symfony/yaml": "~2.7|~3.0|~4.0", + "twig/twig": "~1.26|~2.0" + }, + "suggest": { + "doctrine/orm": "The Doctrine ORM integration is optional in the bundle.", + "symfony/web-profiler-bundle": "To use the data collector." + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-master": "1.8.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Bundle\\DoctrineBundle\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Doctrine Project", + "homepage": "http://www.doctrine-project.org/" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Symfony DoctrineBundle", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "database", + "dbal", + "orm", + "persistence" + ], + "time": "2017-11-24T13:09:19+00:00" + }, + { + "name": "doctrine/doctrine-cache-bundle", + "version": "1.3.2", + "source": { + "type": "git", + "url": "https://github.com/doctrine/DoctrineCacheBundle.git", + "reference": "9baecbd6bfdd1123b0cf8c1b88fee0170a84ddd1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/DoctrineCacheBundle/zipball/9baecbd6bfdd1123b0cf8c1b88fee0170a84ddd1", + "reference": "9baecbd6bfdd1123b0cf8c1b88fee0170a84ddd1", + "shasum": "" + }, + "require": { + "doctrine/cache": "^1.4.2", + "doctrine/inflector": "~1.0", + "php": ">=5.3.2", + "symfony/doctrine-bridge": "~2.2|~3.0|~4.0" + }, + "require-dev": { + "instaclick/coding-standard": "~1.1", + "instaclick/object-calisthenics-sniffs": "dev-master", + "instaclick/symfony2-coding-standard": "dev-remaster", + "phpunit/phpunit": "~4", + "predis/predis": "~0.8", + "satooshi/php-coveralls": "^1.0", + "squizlabs/php_codesniffer": "~1.5", + "symfony/console": "~2.2|~3.0|~4.0", + "symfony/finder": "~2.2|~3.0|~4.0", + "symfony/framework-bundle": "~2.2|~3.0|~4.0", + "symfony/phpunit-bridge": "~2.7|~3.0|~4.0", + "symfony/security-acl": "~2.3|~3.0", + "symfony/validator": "~2.2|~3.0|~4.0", + "symfony/yaml": "~2.2|~3.0|~4.0" + }, + "suggest": { + "symfony/security-acl": "For using this bundle to cache ACLs" + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Bundle\\DoctrineCacheBundle\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Fabio B. Silva", + "email": "fabio.bat.silva@gmail.com" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@hotmail.com" + }, + { + "name": "Doctrine Project", + "homepage": "http://www.doctrine-project.org/" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Symfony Bundle for Doctrine Cache", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "cache", + "caching" + ], + "time": "2017-10-12T17:23:29+00:00" + }, + { + "name": "doctrine/inflector", + "version": "v1.1.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/inflector.git", + "reference": "90b2128806bfde671b6952ab8bea493942c1fdae" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/90b2128806bfde671b6952ab8bea493942c1fdae", + "reference": "90b2128806bfde671b6952ab8bea493942c1fdae", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "require-dev": { + "phpunit/phpunit": "4.*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\Inflector\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Common String Manipulations with regard to casing and singular/plural rules.", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "inflection", + "pluralize", + "singularize", + "string" + ], + "time": "2015-11-06T14:35:42+00:00" + }, + { + "name": "doctrine/instantiator", + "version": "1.0.5", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", + "shasum": "" + }, + "require": { + "php": ">=5.3,<8.0-DEV" + }, + "require-dev": { + "athletic/athletic": "~0.1.8", + "ext-pdo": "*", + "ext-phar": "*", + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "~2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.com/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://github.com/doctrine/instantiator", + "keywords": [ + "constructor", + "instantiate" + ], + "time": "2015-06-14T21:17:01+00:00" + }, + { + "name": "doctrine/lexer", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/lexer.git", + "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/83893c552fd2045dd78aef794c31e694c37c0b8c", + "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\Lexer\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "lexer", + "parser" + ], + "time": "2014-09-09T13:34:57+00:00" + }, + { + "name": "doctrine/orm", + "version": "v2.5.14", + "source": { + "type": "git", + "url": "https://github.com/doctrine/doctrine2.git", + "reference": "810a7baf81462a5ddf10e8baa8cb94b6eec02754" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/doctrine2/zipball/810a7baf81462a5ddf10e8baa8cb94b6eec02754", + "reference": "810a7baf81462a5ddf10e8baa8cb94b6eec02754", + "shasum": "" + }, + "require": { + "doctrine/cache": "~1.4", + "doctrine/collections": "~1.2", + "doctrine/common": ">=2.5-dev,<2.9-dev", + "doctrine/dbal": ">=2.5-dev,<2.7-dev", + "doctrine/instantiator": "^1.0.1", + "ext-pdo": "*", + "php": ">=5.4", + "symfony/console": "~2.5|~3.0|~4.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0", + "symfony/yaml": "~2.3|~3.0|~4.0" + }, + "suggest": { + "symfony/yaml": "If you want to use YAML Metadata Mapping Driver" + }, + "bin": [ + "bin/doctrine", + "bin/doctrine.php" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.6.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\ORM\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + } + ], + "description": "Object-Relational-Mapper for PHP", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "database", + "orm" + ], + "time": "2017-12-17T02:57:51+00:00" + }, + { + "name": "fig/link-util", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/link-util.git", + "reference": "1a07821801a148be4add11ab0603e4af55a72fac" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/link-util/zipball/1a07821801a148be4add11ab0603e4af55a72fac", + "reference": "1a07821801a148be4add11ab0603e4af55a72fac", + "shasum": "" + }, + "require": { + "php": ">=5.5.0", + "psr/link": "~1.0@dev" + }, + "require-dev": { + "phpunit/phpunit": "^5.1", + "squizlabs/php_codesniffer": "^2.3.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Fig\\Link\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common utility implementations for HTTP links", + "keywords": [ + "http", + "http-link", + "link", + "psr", + "psr-13", + "rest" + ], + "time": "2016-10-17T18:31:11+00:00" + }, + { + "name": "incenteev/composer-parameter-handler", + "version": "v2.1.2", + "source": { + "type": "git", + "url": "https://github.com/Incenteev/ParameterHandler.git", + "reference": "d7ce7f06136109e81d1cb9d57066c4d4a99cf1cc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Incenteev/ParameterHandler/zipball/d7ce7f06136109e81d1cb9d57066c4d4a99cf1cc", + "reference": "d7ce7f06136109e81d1cb9d57066c4d4a99cf1cc", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "symfony/yaml": "~2.3|~3.0" + }, + "require-dev": { + "composer/composer": "1.0.*@dev", + "phpspec/prophecy-phpunit": "~1.0", + "symfony/filesystem": "~2.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Incenteev\\ParameterHandler\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christophe Coevoet", + "email": "stof@notk.org" + } + ], + "description": "Composer script handling your ignored parameter file", + "homepage": "https://github.com/Incenteev/ParameterHandler", + "keywords": [ + "parameters management" + ], + "time": "2015-11-10T17:04:01+00:00" + }, + { + "name": "jdorn/sql-formatter", + "version": "v1.2.17", + "source": { + "type": "git", + "url": "https://github.com/jdorn/sql-formatter.git", + "reference": "64990d96e0959dff8e059dfcdc1af130728d92bc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/jdorn/sql-formatter/zipball/64990d96e0959dff8e059dfcdc1af130728d92bc", + "reference": "64990d96e0959dff8e059dfcdc1af130728d92bc", + "shasum": "" + }, + "require": { + "php": ">=5.2.4" + }, + "require-dev": { + "phpunit/phpunit": "3.7.*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "classmap": [ + "lib" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jeremy Dorn", + "email": "jeremy@jeremydorn.com", + "homepage": "http://jeremydorn.com/" + } + ], + "description": "a PHP SQL highlighting library", + "homepage": "https://github.com/jdorn/sql-formatter/", + "keywords": [ + "highlight", + "sql" + ], + "time": "2014-01-12T16:20:24+00:00" + }, + { + "name": "monolog/monolog", + "version": "1.23.0", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/monolog.git", + "reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/fd8c787753b3a2ad11bc60c063cff1358a32a3b4", + "reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "psr/log": "~1.0" + }, + "provide": { + "psr/log-implementation": "1.0.0" + }, + "require-dev": { + "aws/aws-sdk-php": "^2.4.9 || ^3.0", + "doctrine/couchdb": "~1.0@dev", + "graylog2/gelf-php": "~1.0", + "jakub-onderka/php-parallel-lint": "0.9", + "php-amqplib/php-amqplib": "~2.4", + "php-console/php-console": "^3.1.3", + "phpunit/phpunit": "~4.5", + "phpunit/phpunit-mock-objects": "2.3.0", + "ruflin/elastica": ">=0.90 <3.0", + "sentry/sentry": "^0.13", + "swiftmailer/swiftmailer": "^5.3|^6.0" + }, + "suggest": { + "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", + "doctrine/couchdb": "Allow sending log messages to a CouchDB server", + "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", + "ext-mongo": "Allow sending log messages to a MongoDB server", + "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", + "mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver", + "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", + "php-console/php-console": "Allow sending log messages to Google Chrome", + "rollbar/rollbar": "Allow sending log messages to Rollbar", + "ruflin/elastica": "Allow sending log messages to an Elastic Search server", + "sentry/sentry": "Allow sending log messages to a Sentry server" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Monolog\\": "src/Monolog" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "Sends your logs to files, sockets, inboxes, databases and various web services", + "homepage": "http://github.com/Seldaek/monolog", + "keywords": [ + "log", + "logging", + "psr-3" + ], + "time": "2017-06-19T01:22:40+00:00" + }, + { + "name": "paragonie/random_compat", + "version": "v2.0.11", + "source": { + "type": "git", + "url": "https://github.com/paragonie/random_compat.git", + "reference": "5da4d3c796c275c55f057af5a643ae297d96b4d8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/5da4d3c796c275c55f057af5a643ae297d96b4d8", + "reference": "5da4d3c796c275c55f057af5a643ae297d96b4d8", + "shasum": "" + }, + "require": { + "php": ">=5.2.0" + }, + "require-dev": { + "phpunit/phpunit": "4.*|5.*" + }, + "suggest": { + "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." + }, + "type": "library", + "autoload": { + "files": [ + "lib/random.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Paragon Initiative Enterprises", + "email": "security@paragonie.com", + "homepage": "https://paragonie.com" + } + ], + "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", + "keywords": [ + "csprng", + "pseudorandom", + "random" + ], + "time": "2017-09-27T21:40:39+00:00" + }, + { + "name": "psr/cache", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/cache.git", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for caching libraries", + "keywords": [ + "cache", + "psr", + "psr-6" + ], + "time": "2016-08-06T20:24:11+00:00" + }, + { + "name": "psr/container", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "time": "2017-02-14T16:28:37+00:00" + }, + { + "name": "psr/link", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/link.git", + "reference": "eea8e8662d5cd3ae4517c9b864493f59fca95562" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/link/zipball/eea8e8662d5cd3ae4517c9b864493f59fca95562", + "reference": "eea8e8662d5cd3ae4517c9b864493f59fca95562", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Link\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interfaces for HTTP links", + "keywords": [ + "http", + "http-link", + "link", + "psr", + "psr-13", + "rest" + ], + "time": "2016-10-28T16:06:13+00:00" + }, + { + "name": "psr/log", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2016-10-10T12:19:37+00:00" + }, + { + "name": "psr/simple-cache", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/simple-cache.git", + "reference": "753fa598e8f3b9966c886fe13f370baa45ef0e24" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/753fa598e8f3b9966c886fe13f370baa45ef0e24", + "reference": "753fa598e8f3b9966c886fe13f370baa45ef0e24", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\SimpleCache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interfaces for simple caching", + "keywords": [ + "cache", + "caching", + "psr", + "psr-16", + "simple-cache" + ], + "time": "2017-01-02T13:31:39+00:00" + }, + { + "name": "sensio/distribution-bundle", + "version": "v5.0.21", + "source": { + "type": "git", + "url": "https://github.com/sensiolabs/SensioDistributionBundle.git", + "reference": "eb6266b3b472e4002538610b28a0a04bcf94891a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sensiolabs/SensioDistributionBundle/zipball/eb6266b3b472e4002538610b28a0a04bcf94891a", + "reference": "eb6266b3b472e4002538610b28a0a04bcf94891a", + "shasum": "" + }, + "require": { + "php": ">=5.3.9", + "sensiolabs/security-checker": "~3.0|~4.0", + "symfony/class-loader": "~2.3|~3.0", + "symfony/config": "~2.3|~3.0", + "symfony/dependency-injection": "~2.3|~3.0", + "symfony/filesystem": "~2.3|~3.0", + "symfony/http-kernel": "~2.3|~3.0", + "symfony/process": "~2.3|~3.0" + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-master": "5.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Sensio\\Bundle\\DistributionBundle\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Base bundle for Symfony Distributions", + "keywords": [ + "configuration", + "distribution" + ], + "time": "2017-08-25T16:55:44+00:00" + }, + { + "name": "sensio/framework-extra-bundle", + "version": "v3.0.29", + "source": { + "type": "git", + "url": "https://github.com/sensiolabs/SensioFrameworkExtraBundle.git", + "reference": "bb907234df776b68922eb4b25bfa061683597b6a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sensiolabs/SensioFrameworkExtraBundle/zipball/bb907234df776b68922eb4b25bfa061683597b6a", + "reference": "bb907234df776b68922eb4b25bfa061683597b6a", + "shasum": "" + }, + "require": { + "doctrine/common": "~2.2", + "symfony/dependency-injection": "~2.3|~3.0", + "symfony/framework-bundle": "~2.3|~3.0|~4.0" + }, + "require-dev": { + "doctrine/doctrine-bundle": "~1.5", + "doctrine/orm": "~2.4,>=2.4.5", + "symfony/asset": "~2.7|~3.0|~4.0", + "symfony/browser-kit": "~2.3|~3.0|~4.0", + "symfony/dom-crawler": "~2.3|~3.0|~4.0", + "symfony/expression-language": "~2.4|~3.0|~4.0", + "symfony/finder": "~2.3|~3.0|~4.0", + "symfony/phpunit-bridge": "~3.2|~4.0", + "symfony/psr-http-message-bridge": "^0.3|^1.0", + "symfony/security-bundle": "~2.4|~3.0|~4.0", + "symfony/templating": "~2.3|~3.0|~4.0", + "symfony/translation": "~2.3|~3.0|~4.0", + "symfony/twig-bundle": "~2.3|~3.0|~4.0", + "symfony/yaml": "~2.3|~3.0|~4.0", + "twig/twig": "~1.12|~2.0", + "zendframework/zend-diactoros": "^1.3" + }, + "suggest": { + "symfony/expression-language": "", + "symfony/psr-http-message-bridge": "To use the PSR-7 converters", + "symfony/security-bundle": "" + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Sensio\\Bundle\\FrameworkExtraBundle\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "This bundle provides a way to configure your controllers with annotations", + "keywords": [ + "annotations", + "controllers" + ], + "time": "2017-12-14T19:03:23+00:00" + }, + { + "name": "sensiolabs/security-checker", + "version": "v4.1.7", + "source": { + "type": "git", + "url": "https://github.com/sensiolabs/security-checker.git", + "reference": "d539ccba2b4dce515de04f16b7ed7ae5b9eeb434" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sensiolabs/security-checker/zipball/d539ccba2b4dce515de04f16b7ed7ae5b9eeb434", + "reference": "d539ccba2b4dce515de04f16b7ed7ae5b9eeb434", + "shasum": "" + }, + "require": { + "composer/ca-bundle": "^1.0", + "symfony/console": "~2.7|~3.0|~4.0" + }, + "bin": [ + "security-checker" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.1-dev" + } + }, + "autoload": { + "psr-0": { + "SensioLabs\\Security": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien.potencier@gmail.com" + } + ], + "description": "A security checker for your composer.lock", + "time": "2018-01-11T05:54:03+00:00" + }, + { + "name": "swiftmailer/swiftmailer", + "version": "v5.4.9", + "source": { + "type": "git", + "url": "https://github.com/swiftmailer/swiftmailer.git", + "reference": "7ffc1ea296ed14bf8260b6ef11b80208dbadba91" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/7ffc1ea296ed14bf8260b6ef11b80208dbadba91", + "reference": "7ffc1ea296ed14bf8260b6ef11b80208dbadba91", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "mockery/mockery": "~0.9.1", + "symfony/phpunit-bridge": "~3.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.4-dev" + } + }, + "autoload": { + "files": [ + "lib/swift_required.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Chris Corbyn" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Swiftmailer, free feature-rich PHP mailer", + "homepage": "https://swiftmailer.symfony.com", + "keywords": [ + "email", + "mail", + "mailer" + ], + "time": "2018-01-23T07:37:21+00:00" + }, + { + "name": "symfony/monolog-bundle", + "version": "v2.12.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/monolog-bundle.git", + "reference": "b0146bdca7ba2a65f3bbe7010423c7393b29ec3f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/monolog-bundle/zipball/b0146bdca7ba2a65f3bbe7010423c7393b29ec3f", + "reference": "b0146bdca7ba2a65f3bbe7010423c7393b29ec3f", + "shasum": "" + }, + "require": { + "monolog/monolog": "~1.18", + "php": ">=5.3.2", + "symfony/config": "~2.3|~3.0", + "symfony/dependency-injection": "~2.3|~3.0", + "symfony/http-kernel": "~2.3|~3.0", + "symfony/monolog-bridge": "~2.3|~3.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8", + "symfony/console": "~2.3|~3.0", + "symfony/yaml": "~2.3|~3.0" + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Bundle\\MonologBundle\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Symfony MonologBundle", + "homepage": "http://symfony.com", + "keywords": [ + "log", + "logging" + ], + "time": "2017-01-02T19:04:26+00:00" + }, + { + "name": "symfony/polyfill-apcu", + "version": "v1.6.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-apcu.git", + "reference": "04f62674339602def515bff4bc6901fc1d4951e8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-apcu/zipball/04f62674339602def515bff4bc6901fc1d4951e8", + "reference": "04f62674339602def515bff4bc6901fc1d4951e8", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Apcu\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting apcu_* functions to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "apcu", + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2017-10-11T12:05:26+00:00" + }, + { + "name": "symfony/polyfill-intl-icu", + "version": "v1.6.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-icu.git", + "reference": "d2bb2ef00dd8605d6fbd4db53ed4af1395953497" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-icu/zipball/d2bb2ef00dd8605d6fbd4db53ed4af1395953497", + "reference": "d2bb2ef00dd8605d6fbd4db53ed4af1395953497", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "symfony/intl": "~2.3|~3.0|~4.0" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6-dev" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's ICU-related data and classes", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "icu", + "intl", + "polyfill", + "portable", + "shim" + ], + "time": "2017-10-11T12:05:26+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.6.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", + "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2017-10-11T12:05:26+00:00" + }, + { + "name": "symfony/polyfill-php56", + "version": "v1.6.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php56.git", + "reference": "265fc96795492430762c29be291a371494ba3a5b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php56/zipball/265fc96795492430762c29be291a371494ba3a5b", + "reference": "265fc96795492430762c29be291a371494ba3a5b", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "symfony/polyfill-util": "~1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php56\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2017-10-11T12:05:26+00:00" + }, + { + "name": "symfony/polyfill-php70", + "version": "v1.6.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php70.git", + "reference": "0442b9c0596610bd24ae7b5f0a6cdbbc16d9fcff" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/0442b9c0596610bd24ae7b5f0a6cdbbc16d9fcff", + "reference": "0442b9c0596610bd24ae7b5f0a6cdbbc16d9fcff", + "shasum": "" + }, + "require": { + "paragonie/random_compat": "~1.0|~2.0", + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php70\\": "" + }, + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2017-10-11T12:05:26+00:00" + }, + { + "name": "symfony/polyfill-util", + "version": "v1.6.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-util.git", + "reference": "6e719200c8e540e0c0effeb31f96bdb344b94176" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-util/zipball/6e719200c8e540e0c0effeb31f96bdb344b94176", + "reference": "6e719200c8e540e0c0effeb31f96bdb344b94176", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Util\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony utilities for portability of PHP codes", + "homepage": "https://symfony.com", + "keywords": [ + "compat", + "compatibility", + "polyfill", + "shim" + ], + "time": "2017-10-11T12:05:26+00:00" + }, + { + "name": "symfony/swiftmailer-bundle", + "version": "v2.6.7", + "source": { + "type": "git", + "url": "https://github.com/symfony/swiftmailer-bundle.git", + "reference": "c4808f5169efc05567be983909d00f00521c53ec" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/swiftmailer-bundle/zipball/c4808f5169efc05567be983909d00f00521c53ec", + "reference": "c4808f5169efc05567be983909d00f00521c53ec", + "shasum": "" + }, + "require": { + "php": ">=5.3.2", + "swiftmailer/swiftmailer": "~4.2|~5.0", + "symfony/config": "~2.7|~3.0", + "symfony/dependency-injection": "~2.7|~3.0", + "symfony/http-kernel": "~2.7|~3.0" + }, + "require-dev": { + "symfony/console": "~2.7|~3.0", + "symfony/framework-bundle": "~2.7|~3.0", + "symfony/phpunit-bridge": "~3.3@dev", + "symfony/yaml": "~2.7|~3.0" + }, + "suggest": { + "psr/log": "Allows logging" + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-master": "2.6-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Bundle\\SwiftmailerBundle\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Symfony SwiftmailerBundle", + "homepage": "http://symfony.com", + "time": "2017-10-19T01:06:41+00:00" + }, + { + "name": "symfony/symfony", + "version": "v3.4.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/symfony.git", + "reference": "21abeae69baf64d689b04ca33663b4354be1a226" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/symfony/zipball/21abeae69baf64d689b04ca33663b4354be1a226", + "reference": "21abeae69baf64d689b04ca33663b4354be1a226", + "shasum": "" + }, + "require": { + "doctrine/common": "~2.4", + "ext-xml": "*", + "fig/link-util": "^1.0", + "php": "^5.5.9|>=7.0.8", + "psr/cache": "~1.0", + "psr/container": "^1.0", + "psr/link": "^1.0", + "psr/log": "~1.0", + "psr/simple-cache": "^1.0", + "symfony/polyfill-apcu": "~1.1", + "symfony/polyfill-intl-icu": "~1.0", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php56": "~1.0", + "symfony/polyfill-php70": "~1.6", + "symfony/polyfill-util": "~1.0", + "twig/twig": "^1.35|^2.4.4" + }, + "conflict": { + "phpdocumentor/reflection-docblock": "<3.0||>=3.2.0,<3.2.2", + "phpdocumentor/type-resolver": "<0.2.1", + "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0" + }, + "provide": { + "psr/cache-implementation": "1.0", + "psr/container-implementation": "1.0", + "psr/log-implementation": "1.0", + "psr/simple-cache-implementation": "1.0" + }, + "replace": { + "symfony/asset": "self.version", + "symfony/browser-kit": "self.version", + "symfony/cache": "self.version", + "symfony/class-loader": "self.version", + "symfony/config": "self.version", + "symfony/console": "self.version", + "symfony/css-selector": "self.version", + "symfony/debug": "self.version", + "symfony/debug-bundle": "self.version", + "symfony/dependency-injection": "self.version", + "symfony/doctrine-bridge": "self.version", + "symfony/dom-crawler": "self.version", + "symfony/dotenv": "self.version", + "symfony/event-dispatcher": "self.version", + "symfony/expression-language": "self.version", + "symfony/filesystem": "self.version", + "symfony/finder": "self.version", + "symfony/form": "self.version", + "symfony/framework-bundle": "self.version", + "symfony/http-foundation": "self.version", + "symfony/http-kernel": "self.version", + "symfony/inflector": "self.version", + "symfony/intl": "self.version", + "symfony/ldap": "self.version", + "symfony/lock": "self.version", + "symfony/monolog-bridge": "self.version", + "symfony/options-resolver": "self.version", + "symfony/process": "self.version", + "symfony/property-access": "self.version", + "symfony/property-info": "self.version", + "symfony/proxy-manager-bridge": "self.version", + "symfony/routing": "self.version", + "symfony/security": "self.version", + "symfony/security-bundle": "self.version", + "symfony/security-core": "self.version", + "symfony/security-csrf": "self.version", + "symfony/security-guard": "self.version", + "symfony/security-http": "self.version", + "symfony/serializer": "self.version", + "symfony/stopwatch": "self.version", + "symfony/templating": "self.version", + "symfony/translation": "self.version", + "symfony/twig-bridge": "self.version", + "symfony/twig-bundle": "self.version", + "symfony/validator": "self.version", + "symfony/var-dumper": "self.version", + "symfony/web-link": "self.version", + "symfony/web-profiler-bundle": "self.version", + "symfony/web-server-bundle": "self.version", + "symfony/workflow": "self.version", + "symfony/yaml": "self.version" + }, + "require-dev": { + "cache/integration-tests": "dev-master", + "doctrine/annotations": "~1.0", + "doctrine/cache": "~1.6", + "doctrine/data-fixtures": "1.0.*", + "doctrine/dbal": "~2.4", + "doctrine/doctrine-bundle": "~1.4", + "doctrine/orm": "~2.4,>=2.4.5", + "egulias/email-validator": "~1.2,>=1.2.8|~2.0", + "monolog/monolog": "~1.11", + "ocramius/proxy-manager": "~0.4|~1.0|~2.0", + "phpdocumentor/reflection-docblock": "^3.0|^4.0", + "predis/predis": "~1.0", + "symfony/phpunit-bridge": "~3.4|~4.0", + "symfony/security-acl": "~2.8|~3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Bridge\\Doctrine\\": "src/Symfony/Bridge/Doctrine/", + "Symfony\\Bridge\\Monolog\\": "src/Symfony/Bridge/Monolog/", + "Symfony\\Bridge\\ProxyManager\\": "src/Symfony/Bridge/ProxyManager/", + "Symfony\\Bridge\\Twig\\": "src/Symfony/Bridge/Twig/", + "Symfony\\Bundle\\": "src/Symfony/Bundle/", + "Symfony\\Component\\": "src/Symfony/Component/" + }, + "classmap": [ + "src/Symfony/Component/Intl/Resources/stubs" + ], + "exclude-from-classmap": [ + "**/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "The Symfony PHP framework", + "homepage": "https://symfony.com", + "keywords": [ + "framework" + ], + "time": "2018-01-05T08:33:31+00:00" + }, + { + "name": "twig/twig", + "version": "v1.35.0", + "source": { + "type": "git", + "url": "https://github.com/twigphp/Twig.git", + "reference": "daa657073e55b0a78cce8fdd22682fddecc6385f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/daa657073e55b0a78cce8fdd22682fddecc6385f", + "reference": "daa657073e55b0a78cce8fdd22682fddecc6385f", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "psr/container": "^1.0", + "symfony/debug": "~2.7", + "symfony/phpunit-bridge": "~3.3@dev" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.35-dev" + } + }, + "autoload": { + "psr-0": { + "Twig_": "lib/" + }, + "psr-4": { + "Twig\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" + }, + { + "name": "Armin Ronacher", + "email": "armin.ronacher@active-4.com", + "role": "Project Founder" + }, + { + "name": "Twig Team", + "homepage": "http://twig.sensiolabs.org/contributors", + "role": "Contributors" + } + ], + "description": "Twig, the flexible, fast, and secure template language for PHP", + "homepage": "http://twig.sensiolabs.org", + "keywords": [ + "templating" + ], + "time": "2017-09-27T18:06:46+00:00" + } + ], + "packages-dev": [ + { + "name": "sensio/generator-bundle", + "version": "v3.1.7", + "source": { + "type": "git", + "url": "https://github.com/sensiolabs/SensioGeneratorBundle.git", + "reference": "28cbaa244bd0816fd8908b93f90380bcd7b67a65" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sensiolabs/SensioGeneratorBundle/zipball/28cbaa244bd0816fd8908b93f90380bcd7b67a65", + "reference": "28cbaa244bd0816fd8908b93f90380bcd7b67a65", + "shasum": "" + }, + "require": { + "symfony/console": "~2.7|~3.0", + "symfony/framework-bundle": "~2.7|~3.0", + "symfony/process": "~2.7|~3.0", + "symfony/yaml": "~2.7|~3.0", + "twig/twig": "^1.28.2|^2.0" + }, + "require-dev": { + "doctrine/orm": "~2.4", + "symfony/doctrine-bridge": "~2.7|~3.0", + "symfony/filesystem": "~2.7|~3.0", + "symfony/phpunit-bridge": "^3.3" + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-master": "3.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Sensio\\Bundle\\GeneratorBundle\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "This bundle generates code for you", + "time": "2017-12-07T15:36:41+00:00" + }, + { + "name": "symfony/phpunit-bridge", + "version": "v3.4.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/phpunit-bridge.git", + "reference": "24ffb71a115c25f5ee56cbfd38e56ed2cdbeb0a9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/24ffb71a115c25f5ee56cbfd38e56ed2cdbeb0a9", + "reference": "24ffb71a115c25f5ee56cbfd38e56ed2cdbeb0a9", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "conflict": { + "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0" + }, + "suggest": { + "ext-zip": "Zip support is required when using bin/simple-phpunit", + "symfony/debug": "For tracking deprecated interfaces usages at runtime with DebugClassLoader" + }, + "bin": [ + "bin/simple-phpunit" + ], + "type": "symfony-bridge", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + }, + "thanks": { + "name": "phpunit/phpunit", + "url": "https://github.com/sebastianbergmann/phpunit" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Bridge\\PhpUnit\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony PHPUnit Bridge", + "homepage": "https://symfony.com", + "time": "2018-01-04T17:19:23+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": "^5.5.9|>=7.0.8" + }, + "platform-dev": [], + "platform-overrides": { + "php": "5.5.9" + } +} diff --git a/symfony-3.4/phpunit.xml.dist b/symfony-3.4/phpunit.xml.dist new file mode 100644 index 000000000..b115bb395 --- /dev/null +++ b/symfony-3.4/phpunit.xml.dist @@ -0,0 +1,31 @@ + + + + + + + + + + + + tests + + + + + + src + + src/*Bundle/Resources + src/*/*Bundle/Resources + src/*/Bundle/*Bundle/Resources + + + + diff --git a/symfony-3.4/src/AppBundle/AppBundle.php b/symfony-3.4/src/AppBundle/AppBundle.php new file mode 100644 index 000000000..05123b678 --- /dev/null +++ b/symfony-3.4/src/AppBundle/AppBundle.php @@ -0,0 +1,9 @@ +render('default/index.html.twig', [ + 'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..'), + ]); + } +} diff --git a/symfony-3.4/src/AppBundle/Controller/HelloController.php b/symfony-3.4/src/AppBundle/Controller/HelloController.php new file mode 100644 index 000000000..b8b7e924d --- /dev/null +++ b/symfony-3.4/src/AppBundle/Controller/HelloController.php @@ -0,0 +1,18 @@ +request('GET', '/'); + + $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertContains('Welcome to Symfony', $crawler->filter('#container h1')->text()); + } +} diff --git a/symfony-3.4/var/SymfonyRequirements.php b/symfony-3.4/var/SymfonyRequirements.php new file mode 100755 index 000000000..3b14a4022 --- /dev/null +++ b/symfony-3.4/var/SymfonyRequirements.php @@ -0,0 +1,817 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Users of PHP 5.2 should be able to run the requirements checks. + * This is why the file and all classes must be compatible with PHP 5.2+ + * (e.g. not using namespaces and closures). + * + * ************** CAUTION ************** + * + * DO NOT EDIT THIS FILE as it will be overridden by Composer as part of + * the installation/update process. The original file resides in the + * SensioDistributionBundle. + * + * ************** CAUTION ************** + */ + +/** + * Represents a single PHP requirement, e.g. an installed extension. + * It can be a mandatory requirement or an optional recommendation. + * There is a special subclass, named PhpIniRequirement, to check a php.ini configuration. + * + * @author Tobias Schultze + */ +class Requirement +{ + private $fulfilled; + private $testMessage; + private $helpText; + private $helpHtml; + private $optional; + + /** + * Constructor that initializes the requirement. + * + * @param bool $fulfilled Whether the requirement is fulfilled + * @param string $testMessage The message for testing the requirement + * @param string $helpHtml The help text formatted in HTML for resolving the problem + * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) + * @param bool $optional Whether this is only an optional recommendation not a mandatory requirement + */ + public function __construct($fulfilled, $testMessage, $helpHtml, $helpText = null, $optional = false) + { + $this->fulfilled = (bool) $fulfilled; + $this->testMessage = (string) $testMessage; + $this->helpHtml = (string) $helpHtml; + $this->helpText = null === $helpText ? strip_tags($this->helpHtml) : (string) $helpText; + $this->optional = (bool) $optional; + } + + /** + * Returns whether the requirement is fulfilled. + * + * @return bool true if fulfilled, otherwise false + */ + public function isFulfilled() + { + return $this->fulfilled; + } + + /** + * Returns the message for testing the requirement. + * + * @return string The test message + */ + public function getTestMessage() + { + return $this->testMessage; + } + + /** + * Returns the help text for resolving the problem. + * + * @return string The help text + */ + public function getHelpText() + { + return $this->helpText; + } + + /** + * Returns the help text formatted in HTML. + * + * @return string The HTML help + */ + public function getHelpHtml() + { + return $this->helpHtml; + } + + /** + * Returns whether this is only an optional recommendation and not a mandatory requirement. + * + * @return bool true if optional, false if mandatory + */ + public function isOptional() + { + return $this->optional; + } +} + +/** + * Represents a PHP requirement in form of a php.ini configuration. + * + * @author Tobias Schultze + */ +class PhpIniRequirement extends Requirement +{ + /** + * Constructor that initializes the requirement. + * + * @param string $cfgName The configuration name used for ini_get() + * @param bool|callback $evaluation Either a boolean indicating whether the configuration should evaluate to true or false, + * or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement + * @param bool $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false. + * This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin. + * Example: You require a config to be true but PHP later removes this config and defaults it to true internally. + * @param string|null $testMessage The message for testing the requirement (when null and $evaluation is a boolean a default message is derived) + * @param string|null $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a boolean a default help is derived) + * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) + * @param bool $optional Whether this is only an optional recommendation not a mandatory requirement + */ + public function __construct($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null, $optional = false) + { + $cfgValue = ini_get($cfgName); + + if (is_callable($evaluation)) { + if (null === $testMessage || null === $helpHtml) { + throw new InvalidArgumentException('You must provide the parameters testMessage and helpHtml for a callback evaluation.'); + } + + $fulfilled = call_user_func($evaluation, $cfgValue); + } else { + if (null === $testMessage) { + $testMessage = sprintf('%s %s be %s in php.ini', + $cfgName, + $optional ? 'should' : 'must', + $evaluation ? 'enabled' : 'disabled' + ); + } + + if (null === $helpHtml) { + $helpHtml = sprintf('Set %s to %s in php.ini*.', + $cfgName, + $evaluation ? 'on' : 'off' + ); + } + + $fulfilled = $evaluation == $cfgValue; + } + + parent::__construct($fulfilled || ($approveCfgAbsence && false === $cfgValue), $testMessage, $helpHtml, $helpText, $optional); + } +} + +/** + * A RequirementCollection represents a set of Requirement instances. + * + * @author Tobias Schultze + */ +class RequirementCollection implements IteratorAggregate +{ + /** + * @var Requirement[] + */ + private $requirements = array(); + + /** + * Gets the current RequirementCollection as an Iterator. + * + * @return Traversable A Traversable interface + */ + public function getIterator() + { + return new ArrayIterator($this->requirements); + } + + /** + * Adds a Requirement. + * + * @param Requirement $requirement A Requirement instance + */ + public function add(Requirement $requirement) + { + $this->requirements[] = $requirement; + } + + /** + * Adds a mandatory requirement. + * + * @param bool $fulfilled Whether the requirement is fulfilled + * @param string $testMessage The message for testing the requirement + * @param string $helpHtml The help text formatted in HTML for resolving the problem + * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) + */ + public function addRequirement($fulfilled, $testMessage, $helpHtml, $helpText = null) + { + $this->add(new Requirement($fulfilled, $testMessage, $helpHtml, $helpText, false)); + } + + /** + * Adds an optional recommendation. + * + * @param bool $fulfilled Whether the recommendation is fulfilled + * @param string $testMessage The message for testing the recommendation + * @param string $helpHtml The help text formatted in HTML for resolving the problem + * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) + */ + public function addRecommendation($fulfilled, $testMessage, $helpHtml, $helpText = null) + { + $this->add(new Requirement($fulfilled, $testMessage, $helpHtml, $helpText, true)); + } + + /** + * Adds a mandatory requirement in form of a php.ini configuration. + * + * @param string $cfgName The configuration name used for ini_get() + * @param bool|callback $evaluation Either a boolean indicating whether the configuration should evaluate to true or false, + * or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement + * @param bool $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false. + * This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin. + * Example: You require a config to be true but PHP later removes this config and defaults it to true internally. + * @param string $testMessage The message for testing the requirement (when null and $evaluation is a boolean a default message is derived) + * @param string $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a boolean a default help is derived) + * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) + */ + public function addPhpIniRequirement($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null) + { + $this->add(new PhpIniRequirement($cfgName, $evaluation, $approveCfgAbsence, $testMessage, $helpHtml, $helpText, false)); + } + + /** + * Adds an optional recommendation in form of a php.ini configuration. + * + * @param string $cfgName The configuration name used for ini_get() + * @param bool|callback $evaluation Either a boolean indicating whether the configuration should evaluate to true or false, + * or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement + * @param bool $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false. + * This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin. + * Example: You require a config to be true but PHP later removes this config and defaults it to true internally. + * @param string $testMessage The message for testing the requirement (when null and $evaluation is a boolean a default message is derived) + * @param string $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a boolean a default help is derived) + * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) + */ + public function addPhpIniRecommendation($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null) + { + $this->add(new PhpIniRequirement($cfgName, $evaluation, $approveCfgAbsence, $testMessage, $helpHtml, $helpText, true)); + } + + /** + * Adds a requirement collection to the current set of requirements. + * + * @param RequirementCollection $collection A RequirementCollection instance + */ + public function addCollection(RequirementCollection $collection) + { + $this->requirements = array_merge($this->requirements, $collection->all()); + } + + /** + * Returns both requirements and recommendations. + * + * @return Requirement[] + */ + public function all() + { + return $this->requirements; + } + + /** + * Returns all mandatory requirements. + * + * @return Requirement[] + */ + public function getRequirements() + { + $array = array(); + foreach ($this->requirements as $req) { + if (!$req->isOptional()) { + $array[] = $req; + } + } + + return $array; + } + + /** + * Returns the mandatory requirements that were not met. + * + * @return Requirement[] + */ + public function getFailedRequirements() + { + $array = array(); + foreach ($this->requirements as $req) { + if (!$req->isFulfilled() && !$req->isOptional()) { + $array[] = $req; + } + } + + return $array; + } + + /** + * Returns all optional recommendations. + * + * @return Requirement[] + */ + public function getRecommendations() + { + $array = array(); + foreach ($this->requirements as $req) { + if ($req->isOptional()) { + $array[] = $req; + } + } + + return $array; + } + + /** + * Returns the recommendations that were not met. + * + * @return Requirement[] + */ + public function getFailedRecommendations() + { + $array = array(); + foreach ($this->requirements as $req) { + if (!$req->isFulfilled() && $req->isOptional()) { + $array[] = $req; + } + } + + return $array; + } + + /** + * Returns whether a php.ini configuration is not correct. + * + * @return bool php.ini configuration problem? + */ + public function hasPhpIniConfigIssue() + { + foreach ($this->requirements as $req) { + if (!$req->isFulfilled() && $req instanceof PhpIniRequirement) { + return true; + } + } + + return false; + } + + /** + * Returns the PHP configuration file (php.ini) path. + * + * @return string|false php.ini file path + */ + public function getPhpIniConfigPath() + { + return get_cfg_var('cfg_file_path'); + } +} + +/** + * This class specifies all requirements and optional recommendations that + * are necessary to run the Symfony Standard Edition. + * + * @author Tobias Schultze + * @author Fabien Potencier + */ +class SymfonyRequirements extends RequirementCollection +{ + const LEGACY_REQUIRED_PHP_VERSION = '5.3.3'; + const REQUIRED_PHP_VERSION = '5.5.9'; + + /** + * Constructor that initializes the requirements. + */ + public function __construct() + { + /* mandatory requirements follow */ + + $installedPhpVersion = phpversion(); + $requiredPhpVersion = $this->getPhpRequiredVersion(); + + $this->addRecommendation( + $requiredPhpVersion, + 'Vendors should be installed in order to check all requirements.', + 'Run the composer install command.', + 'Run the "composer install" command.' + ); + + if (false !== $requiredPhpVersion) { + $this->addRequirement( + version_compare($installedPhpVersion, $requiredPhpVersion, '>='), + sprintf('PHP version must be at least %s (%s installed)', $requiredPhpVersion, $installedPhpVersion), + sprintf('You are running PHP version "%s", but Symfony needs at least PHP "%s" to run. + Before using Symfony, upgrade your PHP installation, preferably to the latest version.', + $installedPhpVersion, $requiredPhpVersion), + sprintf('Install PHP %s or newer (installed version is %s)', $requiredPhpVersion, $installedPhpVersion) + ); + } + + $this->addRequirement( + version_compare($installedPhpVersion, '5.3.16', '!='), + 'PHP version must not be 5.3.16 as Symfony won\'t work properly with it', + 'Install PHP 5.3.17 or newer (or downgrade to an earlier PHP version)' + ); + + $this->addRequirement( + is_dir(__DIR__.'/../vendor/composer'), + 'Vendor libraries must be installed', + 'Vendor libraries are missing. Install composer following instructions from http://getcomposer.org/. '. + 'Then run "php composer.phar install" to install them.' + ); + + $cacheDir = is_dir(__DIR__.'/../var/cache') ? __DIR__.'/../var/cache' : __DIR__.'/cache'; + + $this->addRequirement( + is_writable($cacheDir), + 'app/cache/ or var/cache/ directory must be writable', + 'Change the permissions of either "app/cache/" or "var/cache/" directory so that the web server can write into it.' + ); + + $logsDir = is_dir(__DIR__.'/../var/logs') ? __DIR__.'/../var/logs' : __DIR__.'/logs'; + + $this->addRequirement( + is_writable($logsDir), + 'app/logs/ or var/logs/ directory must be writable', + 'Change the permissions of either "app/logs/" or "var/logs/" directory so that the web server can write into it.' + ); + + if (version_compare($installedPhpVersion, '7.0.0', '<')) { + $this->addPhpIniRequirement( + 'date.timezone', true, false, + 'date.timezone setting must be set', + 'Set the "date.timezone" setting in php.ini* (like Europe/Paris).' + ); + } + + if (false !== $requiredPhpVersion && version_compare($installedPhpVersion, $requiredPhpVersion, '>=')) { + $timezones = array(); + foreach (DateTimeZone::listAbbreviations() as $abbreviations) { + foreach ($abbreviations as $abbreviation) { + $timezones[$abbreviation['timezone_id']] = true; + } + } + + $this->addRequirement( + isset($timezones[@date_default_timezone_get()]), + sprintf('Configured default timezone "%s" must be supported by your installation of PHP', @date_default_timezone_get()), + 'Your default timezone is not supported by PHP. Check for typos in your php.ini file and have a look at the list of deprecated timezones at http://php.net/manual/en/timezones.others.php.' + ); + } + + $this->addRequirement( + function_exists('iconv'), + 'iconv() must be available', + 'Install and enable the iconv extension.' + ); + + $this->addRequirement( + function_exists('json_encode'), + 'json_encode() must be available', + 'Install and enable the JSON extension.' + ); + + $this->addRequirement( + function_exists('session_start'), + 'session_start() must be available', + 'Install and enable the session extension.' + ); + + $this->addRequirement( + function_exists('ctype_alpha'), + 'ctype_alpha() must be available', + 'Install and enable the ctype extension.' + ); + + $this->addRequirement( + function_exists('token_get_all'), + 'token_get_all() must be available', + 'Install and enable the Tokenizer extension.' + ); + + $this->addRequirement( + function_exists('simplexml_import_dom'), + 'simplexml_import_dom() must be available', + 'Install and enable the SimpleXML extension.' + ); + + if (function_exists('apc_store') && ini_get('apc.enabled')) { + if (version_compare($installedPhpVersion, '5.4.0', '>=')) { + $this->addRequirement( + version_compare(phpversion('apc'), '3.1.13', '>='), + 'APC version must be at least 3.1.13 when using PHP 5.4', + 'Upgrade your APC extension (3.1.13+).' + ); + } else { + $this->addRequirement( + version_compare(phpversion('apc'), '3.0.17', '>='), + 'APC version must be at least 3.0.17', + 'Upgrade your APC extension (3.0.17+).' + ); + } + } + + $this->addPhpIniRequirement('detect_unicode', false); + + if (extension_loaded('suhosin')) { + $this->addPhpIniRequirement( + 'suhosin.executor.include.whitelist', + create_function('$cfgValue', 'return false !== stripos($cfgValue, "phar");'), + false, + 'suhosin.executor.include.whitelist must be configured correctly in php.ini', + 'Add "phar" to suhosin.executor.include.whitelist in php.ini*.' + ); + } + + if (extension_loaded('xdebug')) { + $this->addPhpIniRequirement( + 'xdebug.show_exception_trace', false, true + ); + + $this->addPhpIniRequirement( + 'xdebug.scream', false, true + ); + + $this->addPhpIniRecommendation( + 'xdebug.max_nesting_level', + create_function('$cfgValue', 'return $cfgValue > 100;'), + true, + 'xdebug.max_nesting_level should be above 100 in php.ini', + 'Set "xdebug.max_nesting_level" to e.g. "250" in php.ini* to stop Xdebug\'s infinite recursion protection erroneously throwing a fatal error in your project.' + ); + } + + $pcreVersion = defined('PCRE_VERSION') ? (float) PCRE_VERSION : null; + + $this->addRequirement( + null !== $pcreVersion, + 'PCRE extension must be available', + 'Install the PCRE extension (version 8.0+).' + ); + + if (extension_loaded('mbstring')) { + $this->addPhpIniRequirement( + 'mbstring.func_overload', + create_function('$cfgValue', 'return (int) $cfgValue === 0;'), + true, + 'string functions should not be overloaded', + 'Set "mbstring.func_overload" to 0 in php.ini* to disable function overloading by the mbstring extension.' + ); + } + + /* optional recommendations follow */ + + if (file_exists(__DIR__.'/../vendor/composer')) { + require_once __DIR__.'/../vendor/autoload.php'; + + try { + $r = new ReflectionClass('Sensio\Bundle\DistributionBundle\SensioDistributionBundle'); + + $contents = file_get_contents(dirname($r->getFileName()).'/Resources/skeleton/app/SymfonyRequirements.php'); + } catch (ReflectionException $e) { + $contents = ''; + } + $this->addRecommendation( + file_get_contents(__FILE__) === $contents, + 'Requirements file should be up-to-date', + 'Your requirements file is outdated. Run composer install and re-check your configuration.' + ); + } + + $this->addRecommendation( + version_compare($installedPhpVersion, '5.3.4', '>='), + 'You should use at least PHP 5.3.4 due to PHP bug #52083 in earlier versions', + 'Your project might malfunction randomly due to PHP bug #52083 ("Notice: Trying to get property of non-object"). Install PHP 5.3.4 or newer.' + ); + + $this->addRecommendation( + version_compare($installedPhpVersion, '5.3.8', '>='), + 'When using annotations you should have at least PHP 5.3.8 due to PHP bug #55156', + 'Install PHP 5.3.8 or newer if your project uses annotations.' + ); + + $this->addRecommendation( + version_compare($installedPhpVersion, '5.4.0', '!='), + 'You should not use PHP 5.4.0 due to the PHP bug #61453', + 'Your project might not work properly due to the PHP bug #61453 ("Cannot dump definitions which have method calls"). Install PHP 5.4.1 or newer.' + ); + + $this->addRecommendation( + version_compare($installedPhpVersion, '5.4.11', '>='), + 'When using the logout handler from the Symfony Security Component, you should have at least PHP 5.4.11 due to PHP bug #63379 (as a workaround, you can also set invalidate_session to false in the security logout handler configuration)', + 'Install PHP 5.4.11 or newer if your project uses the logout handler from the Symfony Security Component.' + ); + + $this->addRecommendation( + (version_compare($installedPhpVersion, '5.3.18', '>=') && version_compare($installedPhpVersion, '5.4.0', '<')) + || + version_compare($installedPhpVersion, '5.4.8', '>='), + 'You should use PHP 5.3.18+ or PHP 5.4.8+ to always get nice error messages for fatal errors in the development environment due to PHP bug #61767/#60909', + 'Install PHP 5.3.18+ or PHP 5.4.8+ if you want nice error messages for all fatal errors in the development environment.' + ); + + if (null !== $pcreVersion) { + $this->addRecommendation( + $pcreVersion >= 8.0, + sprintf('PCRE extension should be at least version 8.0 (%s installed)', $pcreVersion), + 'PCRE 8.0+ is preconfigured in PHP since 5.3.2 but you are using an outdated version of it. Symfony probably works anyway but it is recommended to upgrade your PCRE extension.' + ); + } + + $this->addRecommendation( + class_exists('DomDocument'), + 'PHP-DOM and PHP-XML modules should be installed', + 'Install and enable the PHP-DOM and the PHP-XML modules.' + ); + + $this->addRecommendation( + function_exists('mb_strlen'), + 'mb_strlen() should be available', + 'Install and enable the mbstring extension.' + ); + + $this->addRecommendation( + function_exists('utf8_decode'), + 'utf8_decode() should be available', + 'Install and enable the XML extension.' + ); + + $this->addRecommendation( + function_exists('filter_var'), + 'filter_var() should be available', + 'Install and enable the filter extension.' + ); + + if (!defined('PHP_WINDOWS_VERSION_BUILD')) { + $this->addRecommendation( + function_exists('posix_isatty'), + 'posix_isatty() should be available', + 'Install and enable the php_posix extension (used to colorize the CLI output).' + ); + } + + $this->addRecommendation( + extension_loaded('intl'), + 'intl extension should be available', + 'Install and enable the intl extension (used for validators).' + ); + + if (extension_loaded('intl')) { + // in some WAMP server installations, new Collator() returns null + $this->addRecommendation( + null !== new Collator('fr_FR'), + 'intl extension should be correctly configured', + 'The intl extension does not behave properly. This problem is typical on PHP 5.3.X x64 WIN builds.' + ); + + // check for compatible ICU versions (only done when you have the intl extension) + if (defined('INTL_ICU_VERSION')) { + $version = INTL_ICU_VERSION; + } else { + $reflector = new ReflectionExtension('intl'); + + ob_start(); + $reflector->info(); + $output = strip_tags(ob_get_clean()); + + preg_match('/^ICU version +(?:=> )?(.*)$/m', $output, $matches); + $version = $matches[1]; + } + + $this->addRecommendation( + version_compare($version, '4.0', '>='), + 'intl ICU version should be at least 4+', + 'Upgrade your intl extension with a newer ICU version (4+).' + ); + + if (class_exists('Symfony\Component\Intl\Intl')) { + $this->addRecommendation( + \Symfony\Component\Intl\Intl::getIcuDataVersion() <= \Symfony\Component\Intl\Intl::getIcuVersion(), + sprintf('intl ICU version installed on your system is outdated (%s) and does not match the ICU data bundled with Symfony (%s)', \Symfony\Component\Intl\Intl::getIcuVersion(), \Symfony\Component\Intl\Intl::getIcuDataVersion()), + 'To get the latest internationalization data upgrade the ICU system package and the intl PHP extension.' + ); + if (\Symfony\Component\Intl\Intl::getIcuDataVersion() <= \Symfony\Component\Intl\Intl::getIcuVersion()) { + $this->addRecommendation( + \Symfony\Component\Intl\Intl::getIcuDataVersion() === \Symfony\Component\Intl\Intl::getIcuVersion(), + sprintf('intl ICU version installed on your system (%s) does not match the ICU data bundled with Symfony (%s)', \Symfony\Component\Intl\Intl::getIcuVersion(), \Symfony\Component\Intl\Intl::getIcuDataVersion()), + 'To avoid internationalization data inconsistencies upgrade the symfony/intl component.' + ); + } + } + + $this->addPhpIniRecommendation( + 'intl.error_level', + create_function('$cfgValue', 'return (int) $cfgValue === 0;'), + true, + 'intl.error_level should be 0 in php.ini', + 'Set "intl.error_level" to "0" in php.ini* to inhibit the messages when an error occurs in ICU functions.' + ); + } + + $accelerator = + (extension_loaded('eaccelerator') && ini_get('eaccelerator.enable')) + || + (extension_loaded('apc') && ini_get('apc.enabled')) + || + (extension_loaded('Zend Optimizer+') && ini_get('zend_optimizerplus.enable')) + || + (extension_loaded('Zend OPcache') && ini_get('opcache.enable')) + || + (extension_loaded('xcache') && ini_get('xcache.cacher')) + || + (extension_loaded('wincache') && ini_get('wincache.ocenabled')) + ; + + $this->addRecommendation( + $accelerator, + 'a PHP accelerator should be installed', + 'Install and/or enable a PHP accelerator (highly recommended).' + ); + + if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { + $this->addRecommendation( + $this->getRealpathCacheSize() >= 5 * 1024 * 1024, + 'realpath_cache_size should be at least 5M in php.ini', + 'Setting "realpath_cache_size" to e.g. "5242880" or "5M" in php.ini* may improve performance on Windows significantly in some cases.' + ); + } + + $this->addPhpIniRecommendation('short_open_tag', false); + + $this->addPhpIniRecommendation('magic_quotes_gpc', false, true); + + $this->addPhpIniRecommendation('register_globals', false, true); + + $this->addPhpIniRecommendation('session.auto_start', false); + + $this->addRecommendation( + class_exists('PDO'), + 'PDO should be installed', + 'Install PDO (mandatory for Doctrine).' + ); + + if (class_exists('PDO')) { + $drivers = PDO::getAvailableDrivers(); + $this->addRecommendation( + count($drivers) > 0, + sprintf('PDO should have some drivers installed (currently available: %s)', count($drivers) ? implode(', ', $drivers) : 'none'), + 'Install PDO drivers (mandatory for Doctrine).' + ); + } + } + + /** + * Loads realpath_cache_size from php.ini and converts it to int. + * + * (e.g. 16k is converted to 16384 int) + * + * @return int + */ + protected function getRealpathCacheSize() + { + $size = ini_get('realpath_cache_size'); + $size = trim($size); + $unit = ''; + if (!ctype_digit($size)) { + $unit = strtolower(substr($size, -1, 1)); + $size = (int) substr($size, 0, -1); + } + switch ($unit) { + case 'g': + return $size * 1024 * 1024 * 1024; + case 'm': + return $size * 1024 * 1024; + case 'k': + return $size * 1024; + default: + return (int) $size; + } + } + + /** + * Defines PHP required version from Symfony version. + * + * @return string|false The PHP required version or false if it could not be guessed + */ + protected function getPhpRequiredVersion() + { + if (!file_exists($path = __DIR__.'/../composer.lock')) { + return false; + } + + $composerLock = json_decode(file_get_contents($path), true); + foreach ($composerLock['packages'] as $package) { + $name = $package['name']; + if ('symfony/symfony' !== $name && 'symfony/http-kernel' !== $name) { + continue; + } + + return (int) $package['version'][1] > 2 ? self::REQUIRED_PHP_VERSION : self::LEGACY_REQUIRED_PHP_VERSION; + } + + return false; + } +} diff --git a/symfony-3.4/var/cache/.gitkeep b/symfony-3.4/var/cache/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/symfony-3.4/var/logs/.gitkeep b/symfony-3.4/var/logs/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/symfony-3.4/var/sessions/.gitkeep b/symfony-3.4/var/sessions/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/symfony-3.4/web/app.php b/symfony-3.4/web/app.php new file mode 100644 index 000000000..ff372e2ca --- /dev/null +++ b/symfony-3.4/web/app.php @@ -0,0 +1,32 @@ +unregister(); +$apcLoader->register(true); +*/ + +$kernel = new AppKernel('prod', false); +$kernel->loadClassCache(); +//$kernel = new AppCache($kernel); + +// When using the HttpCache, you need to call the method in your front controller instead of relying on the configuration parameter +//Request::enableHttpMethodParameterOverride(); +$request = Request::createFromGlobals(); +$response = $kernel->handle($request); +$response->send(); +$kernel->terminate($request, $response); + +require __DIR__ . '/../../libs/output_data.php'; diff --git a/symfony-3.4/web/app_dev.php b/symfony-3.4/web/app_dev.php new file mode 100644 index 000000000..8456754d5 --- /dev/null +++ b/symfony-3.4/web/app_dev.php @@ -0,0 +1,32 @@ +loadClassCache(); +$request = Request::createFromGlobals(); +$response = $kernel->handle($request); +$response->send(); +$kernel->terminate($request, $response); diff --git a/symfony-3.4/web/apple-touch-icon.png b/symfony-3.4/web/apple-touch-icon.png new file mode 100644 index 000000000..11f17e6d8 Binary files /dev/null and b/symfony-3.4/web/apple-touch-icon.png differ diff --git a/symfony-3.4/web/config.php b/symfony-3.4/web/config.php new file mode 100644 index 000000000..fd7e17e6b --- /dev/null +++ b/symfony-3.4/web/config.php @@ -0,0 +1,422 @@ +getFailedRequirements(); +$minorProblems = $symfonyRequirements->getFailedRecommendations(); +$hasMajorProblems = (bool) count($majorProblems); +$hasMinorProblems = (bool) count($minorProblems); + +?> + + + + + + Symfony Configuration Checker + + + +
+
+ + + +
+ +
+
+
+

Configuration Checker

+

+ This script analyzes your system to check whether is + ready to run Symfony applications. +

+ + +

Major problems

+

Major problems have been detected and must be fixed before continuing:

+
    + +
  1. getTestMessage() ?> +

    getHelpHtml() ?>

    +
  2. + +
+ + + +

Recommendations

+

+ Additionally, toTo enhance your Symfony experience, + it’s recommended that you fix the following: +

+
    + +
  1. getTestMessage() ?> +

    getHelpHtml() ?>

    +
  2. + +
+ + + hasPhpIniConfigIssue()): ?> +

* + getPhpIniConfigPath()): ?> + Changes to the php.ini file must be done in "getPhpIniConfigPath() ?>". + + To change settings, create a "php.ini". + +

+ + + +

All checks passed successfully. Your system is ready to run Symfony applications.

+ + + +
+
+
+
Symfony Standard Edition
+
+ + diff --git a/symfony-3.4/web/favicon.ico b/symfony-3.4/web/favicon.ico new file mode 100644 index 000000000..479f7f50f Binary files /dev/null and b/symfony-3.4/web/favicon.ico differ diff --git a/symfony-3.4/web/robots.txt b/symfony-3.4/web/robots.txt new file mode 100644 index 000000000..4665fcae3 --- /dev/null +++ b/symfony-3.4/web/robots.txt @@ -0,0 +1,5 @@ +# www.robotstxt.org/ +# www.google.com/support/webmasters/bin/answer.py?hl=en&answer=156449 + +User-agent: * +Disallow: