Salamander
Salamander 1.0
スリムに基づくシンプルで高速のPHPフレームワーク
1. Web Root Directory(nginxなど)を構成し、index.phpファイルに書き換えるリクエスト
root D:/your_web_project/Salamander/public;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ .php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
2。PHP依存関係をインストールします
composer install
app [application backend directory]
├── Controller [controller directory]
├── Library [Library folder]
├── Middleware [Middleware folder]
├── Service [Logic business folder]
├── settings [Slim settings folder]
|── dependencies.php [Slim dependencies settings folder]
|── middleware.php [Slim middleware settings folder]
├── Tool [Tool folder]
├── template [template folder]
├── config.php [config file]
├── functions.php [common functions file]
├── ini.php [web init file]
├── routes.php [routes file]
assets [frontend source directory]
public [web root directory]
├── index.php [entrance php script file]
composer.json [composer file]
README.md [readme file]
ルーティング分布と依存関係インジェクションの使用スリム、routes.phpはリクエストルーティング、settings/dependencies.phpセットグローバル依存関係を設定します
制御レイヤー:クラスを作成してBasecontrollerクラスを継承すると、クラスメソッドに3つのパラメーターが注入されます。
ビジネスロジックレイヤー:BaseServiceクラスを継承するクラスを作成し、DB(DB属性を介して)を操作し、他の依存関係を呼び出してビジネスロジックを実装します。