Update license name
readme: fix URL of adaptive screenshot
readme: use relative URL for screenshots
This project provides the backbone for the content a business might want to display on their website
Simple and clear style
Adapts to differently sized screens, using only CSS media queries
Minimal JavaScript for loading pages through AJAX requests
CSS-only slideshow and gallery page
Routing controlled by PHP with...
A basic language system
Folder with AllowOverride enabled for .htaccess
Enable httpd modules:
The /static
folder is the only one containing the files that users are able to download.
All other requests are silently redirected to /src/index.php
.
As such, store any files that users must be able to download in /static
- that includes
JavaScript, CSS, and images.
See .htaccess
to see how this is done using the rewrite engine.
See /src/index.php
and /src/routes.php
for more simple examples.
$router = new Router;
$router->use( function() {
echo 'This is called for all requests<br>';
} );
$router->post( function() {
echo 'This is called for all POST requests<br>';
} );
$router->use( function() {
echo 'This is always the last controller called';
return true; // Stop other controllers running after this
} );
Methods available for GET
, POST
, PUT
, and DELETE
, all following the same format
$router->use( '/', function() {
echo 'You\'re home!<br>';
} );
$router->use( '/.*', function() {
echo 'You\'re away from home<br>';
} );
$router->use( '/foo', function() {
echo 'You\'re at /foo<br>';
return true;
} );
$router->use( '/foo*', function() {
echo 'Your request began with /foo<br>';
return true;
} );
$params
is provided as a parameter in each callback. It is also available in the global scope.
It contains the matched information from the URL pattern used.
$router->use( '/foo/:bar', function( $params ) {
echo $params['bar'];
return true;
} );
// Go to /foo: no output
// Go to /foo/1: 1
// Go to /foo/string: string
$router->use( '/foo/:bar/:baz', function( $params ) {
print_r( $params );
return true;
} );
// Go to /foo: no output
// Go to /foo/1: no output
// Go to /foo/1/2: Array ( [0] => /foo/1/2/ [bar] => 1 [1] => 1 [baz] => 2 [2] => 2 )
Facebook logo - Zlatko Najdenovski (CC BY 3.0)
Menu icon - Google material icons (Apache 2.0)
SVG flags - Panayiotis Lipiridis (MIT License)