danc0/gimliduck-php
最新稳定版本:v1.2.1
Composer 安装命令:
composer require danc0/gimliduck-php
包简介
GimliDuck is an adaptable micro PHP framework that tries to stay out of your way.
README 文档
README
An adaptable micro PHP framework that tries to stay out of your way.
Certainty of death. Small chance of success. What are we waiting for?
Installation
composer require danc0/gimliduck-php
Create a skeleton project with:
composer create-project danc0/gimli-skeleton
Add the devtools with composer require --dev danc0/gimliduck-devtools
Create a .htaccess file that looks something like this to point requests to your index.php file
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
Usage
Creating a GimliDuck application is simple:
declare(strict_types=1); require_once __DIR__ . '/vendor/autoload.php'; use Gimli\Application; use Gimli\Application_Registry; use Gimli\Router\Route; $App = Application::create(__DIR__, $_SERVER); Route::get('/', function(){ echo "Hello World"; }); Application_Registry::set($App); $App->run();
That is really all you need to get started. You can add more like a template engine, a config file, etc, but you don't have to.
A more complex example
<?php declare(strict_types=1); require_once __DIR__ . '/vendor/autoload.php'; use Gimli\Application; use Gimli\Application_Registry; use App\Core\Config; use App\Core\Cache; define('APP_ROOT', __DIR__); $App = Application::create(APP_ROOT, $_SERVER); // set up your config and add it to the Application $config_file = parse_ini_file(APP_ROOT . '/App/Core/config.ini', true); $App->Config = $App->Injector->resolveFresh(Config::class, ['config' => $config_file], $App); // Register a cache class with the Injector $App->Injector->register(Cache::class, Cache::getCache($App->Config->admin_cache)); Application_Registry::set($App); // Run Application $App->run();
Read the Docs for more information and examples.
统计信息
- 总下载量: 542
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unlicense
- 更新时间: 2024-01-25