PHP code example of rotlesnake / fast-api-php
1. Go to this page and download the library: Download rotlesnake/fast-api-php library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
rotlesnake / fast-api-php example snippets
composer install rotlesnake/fast-api-php
+App
|----Auth
| |------Controllers
| | |--------------LoginController.php
| |------Models
| |--------------Users.php
|----ModuleOne
|------Controllers
| |--------------IndexController.php
|------Models
|--------------Items.php
.htaccess
index.php
define("APP_PATH", str_replace("/", DIRECTORY_SEPARATOR, realpath(__DIR__)."/App/") );
define("ROOT_URL", str_replace("//", "/", dirname($_SERVER["SCRIPT_NAME"])."/") );
$settings = [
'debug' => true,
'timezone' => 'Etc/GMT-3',
'locale' => 'ru_RU.UTF-8',
'database' => [
'driver' => 'sqlite',
'database' => APP_PATH."database.db",
'prefix' => '',
],
// --- or ---
'database' => [
'driver' => 'mysql',
'host' => 'localhost',
'port' => '3306',
'database' => 'learn',
'username' => 'root',
'password' => '',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => 'prj_',
'engine' => 'InnoDB', //'InnoDB' 'MyISAM'
],
];
ini_set('date.timezone', $settings['timezone']);
date_default_timezone_set($settings['timezone']);
setlocale(LC_TIME, $settings['locale']);
ignore_user_abort(true);
$APP = new \FastApiPHP\App(APP_PATH, ROOT_URL);
$APP->init($settings);
$APP->run();