PHP Luminova Framework
PHP Luminova framework is built for speed and keeping your existing coding skills going.
Installation Guide
Installation via composer
composer create-project nanoblocktech/luminova project-root
Installation via git
$ git clone https://github.com/nanoblocktech/luminova
$ composer install
$ composer test
Manual Installation
Download the framework project and extract it as zip in your project directory
Server Configuration
Let's start by creating the first website using the Luminova framework
The first thing to do is configure your web server to use a custom document root which should be path/to/your/project/public
.Assuming your existing document root is user/var/www/public_html
now you have to change it to user/var/www/project/public
or user/var/www/public_html/public
. The project
or public_html
will serve as your private document root where the framework files will be located which is not accessible from web browsers.
Document Root Configuration Samples
<VirtualHost *:80>
DocumentRoot "/opt/lamp/apache2/project/public"
ErrorLog "logs/project/error_log"
CustomLog "logs/project/access_log" common
<Directory "/opt/lamp/apache2/project/public">
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
The above configuration assumes the project folder is located as follows:
apache2/
├── project/ (Project Folder)
│ └── public/ (DocumentRoot for project)
└── htdocs/
IMPORTANTMake sure you set the required permissions for public
directory to be accessible in browsers.
Now that we are done setting up our website document root let's head to uploading our project online.Upload your project version which is located on builds/v-{*}
folder, to your project private directory.
Routing
Luminova comes with three web, API, and CLI
routing interfaces where you can register your project routes.Framework will redirect every request that doesn't start with API
or CLI
to your main web controller, so make sure you don't have any custom web routes that start with any of the paths API or CLI
, for example https://example.com/api/.*
will be considered as API request.
WEB
The web interface will handle all your website implementation.Location: /routes/web.php
CLI
The CLI interface will handle all your command-line implementationLocation: /routes/cli.php
API
The API interface will handle all your API implementationLocation: /routes/api.php
Register Web/Api Routes
Within any of your routes files located in /routes/
, you can register routes with patterns and methods depending on your use case.
Examples
For API and Website routes, they use the same method, on like CLI routes.
$router->before('GET|POST', '/.*', function () {
/*
Set up your website's global security here such as sessions etc....
Or you can also do it in a bind
*/
});
/*
The landing page goes here if you need to
*/
$router->get('/', function() use ($app) {
/*
Render your landing page view
*/
$app->render("index")->view();
});
Documentation
More usage documentation for PHP Luminova.