fm_ph / quark
Quark server
v1.7.3
2017-10-06 08:59 UTC
Requires
- php: ^7.0
- fig/http-message-util: ^1.1
- filp/whoops: ^2.1
- geocoder-php/chain-provider: ^4.0
- geocoder-php/free-geoip-provider: ^4.0
- geocoder-php/geo-plugin-provider: ^4.0
- geocoder-php/host-ip-provider: ^4.0
- gpolguere/path-to-regexp-php: dev-master
- hassankhan/config: ^0.10.0
- nochso/html-compress-twig: ^2.0
- php-http/guzzle6-adapter: ^1.1
- php-http/message: ^1.5
- symfony/yaml: ^3.2
- twig/twig: ^2.4
- whichbrowser/parser: ^2.0
- willdurand/geocoder: 4.1.0
README
Server part of quark
framework handling mainly the routing and templating.
Features
- Routing : Methods, regex parameters, redirect, locale.
- Templating : Twig (layouts, cache, customs extensions, filters, globals...).
- Locale : IP address detection (Geocoder with providers chain), fallback to prefered browser locale.
- User agent : Browser, engine, operating system, device, bot and old browser detection.
- Manifest : Assets hash, environment.
- Configuration : Supports PHP, INI, XML, JSON, and YAML file formats.
- Others : Error handler, function helpers.
Installation
Get Composer and run :
composer require fm_ph/quark
Note : You need at least PHP 7.x (CLI) installed on your machine to use this package (verify it with php -v
).
For OS X users, you can easily update it on https://php-osx.liip.ch/.
Usage
Basic
Get an Application
singleton instance and render matched route template.
<?php define('BASE_PATH', __DIR__); // Require Composer autoloader require BASE_PATH . '/vendor/autoload.php'; // Get Application instance and init $app = Quark\Application::getInstance(); $app->init(); // Render echo $app->render();
Custom configuration
Init Application
with custom configuration.
<?php // ... // Custom configuration $config = [ 'locale' => [ 'code' => 'fr', 'redirectIfOne' => true ] ] // Get Application instance $app = Quark\Application::getInstance(); // Init with custom configuration array $app->init($config);
Configuration
All configuration properties that can be passed to init()
method on an Application
instance.
Old browser
Locale
Paths
Twig
API
See https://fm-ph.github.io/quark-server/
Testing
Install PHPUnit globally :
composer global require phpunit/phpunit
And run the tests with :
phpunit
License
MIT License © Patrick Heng Fabien Motte