ngames / framework
The NGames Framework is a simple PHP framework developped for the websites https://www.worldwar.fr and https://www.guide-tnt.fr
Requires
- php: >= 8
- doctrine/annotations: ~2.0.1
- symfony/cache: ^7.1.2
Requires (Dev)
- friendsofphp/php-cs-fixer: ~3.59.3
- phpunit/phpunit: ~11.2.8
This package is auto-updated.
Last update: 2025-04-06 16:57:38 UTC
README
Installation
Use composer to install the application: composer require ngames/framework
. Or you can update the composer.json
file by adding the following line in the require
object:
{ "require": { "ngames/framework": "~0.3" } }
Usage
Configuration file
You need to write a configuration file using INI format. Typically, this file is called config.ini
and is located in the config
folder at the root of the project. Here is an example with all supported configuration keys:
# Database configuration database.host = "127.0.0.1" database.username = "db_user" database.password = "db_password" database.name = "db_name" # Log configuration (destination must be a file), the level is the minimum level for logging messages log.destination = "./logs/application.log" log.level = "debug" # Whether the debug mode is enabled or not (default is false) debug = "true"
Application initialization
In a public
folder in the root of the project, create a file named index.php
with the following content:
<?php defined("ROOT_DIR") || define ("ROOT_DIR", dirname(__DIR__)); chdir(ROOT_DIR); // Initialize and run the application require_once ROOT_DIR . '/vendor/autoload.php'; \Ngames\Framework\Application::initialize(ROOT_DIR . '/config/config.ini')->run();
That's all you need to startup the application.
Controllers
Controllers are located in a src
folder in the root of the project. They are grouped by folders representing the modules. The default module is Application
.