Directly
Micro-framework PHP to provider web pages quickly, (*1)
Installation
It's recommended that you use Composer to install Directly., (*2)
$ composer require wallrio/directly "*"
Usage
Create an index.php file with the following contents:, (*3)
<?php
require 'vendor/autoload.php';
use directly\Directly as Directly;
$directly = new Directly('application');
$directly->run('/');
Create an .htaccess file with the following contents:, (*4)
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ index.php [L]
</IfModule>
Class Directly()
-
new Directly(DIRECTORY-YOUR-APP);, (*5)
DIRECTORY-YOUR-APP = specifies the application directory (optional)
-
$directly->run(ROUTE);, (*6)
ROUTE = specifies an initial route (optional)
-
Optionally you can force a home directory for your files, use the attribute below for this:, (*7)
$directly->publicDir = 'DIRECTORY-PUBLIC';, (*8)
DIRECTORY-PUBLIC = specify a directory after the directory of your application
example
$directly->publicDir = 'assets';
Struct directory
/your-directory-project
|
|--application/
| |
| |--error
| | |--404
| | |--view.php
| |
| |--global
| | |--header.php
| | |--footer.php
| |
| |--inc
| | |--menu.php
| |
| |--view
| |--home
| |--view.php
| |--about
| |--view.php
| |--contact
| |--view.php
|
|--- .htaccess
|--- index.php
Other options
$directly->publicDir = 'assets';
[=inc:menu.php=] = includes no document the contents of the menu.php file located in the directory /application/inc
[=inc-route:meta.php=] = includes no document the contents of the menu.php file located in the directory /application/view/CURRENT-PAGE/meta.php
[=global:FILE_NAME=] = includes no document the contents of the menu.php file located in the directory /application/global/FILE_NAME.php
[=domain:url=] = replace to url of domain
License
The Directly Framework is licensed under the MIT license. See License File for more information., (*9)