Symfony
#php
#WEBフレームワーク
Symfony, High Performance PHP Framework for Web Development
PHPの軽量フレームワーク
マイクロサービスでも使えそう。
Symfony ディレクトリ構成
https://symfony.com/doc/3.x/quick_tour/the_architecture.html
Routing
https://github.com/symfony/routing
これか?
code:router
use App\Controller\BlogApiController;
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
return function (RoutingConfigurator $routes) {
$routes->add('api_post_show', '/api/posts/{id}')
->controller(BlogApiController::class, 'show')
->methods('GET', 'HEAD')
;
$routes->add('api_post_edit', '/api/posts/{id}')
->controller(BlogApiController::class, 'edit')
->methods('PUT')
;
};
コントローラーでResponseを生成し、返している
code:controller
return new Response(
'<html><body>Lucky number: '.$number.'</body></html>'
);
Symfony4のHttpKernelクラスが処理していること | QUARTETCOM TECH BLOG
コントローラー
https://symfony.com/doc/current/controller.html
https://www.twilio.com/ja/blog/building-a-single-page-application-with-symfony-php-and-react-jp
認証
OIDC
https://symfony.com/doc/current/security/access_token.html#using-openid-connect-oidc
フロントエンド
AssetMapper
https://symfony.com/doc/current/frontend/asset_mapper.html
独自でビルドしていた場合は、publicフォルダに配置するようにしておけば良いかな。
デプロイ
アップロード
composerでinstall
マイグレーション
レガシーシステムDBはどうするのか
キャッシュクリア
フロント含む?
他のデプロイタスク
タギング
テスト実行
不要なファイル削除
FTP, sshマニュアルはやめたい
Gitも良いとは言えない
本番用パッケージ、インストールコマンド
composer install --no-dev --optimize-autoloader
デプロイのロールバック
Ansibleは有力か
https://ansistrano.com/
デプロイ用プラットフォームがある
https://platform.sh/
環境設定
https://symfony.com/doc/current/configuration.html#creating-a-new-environment
.envはコミット推奨
.env.localで上書きする。
.env.localは、.gitignoreに入れる
環境変数を暗語化する仕組みがある
https://symfony.com/doc/current/configuration.html#encrypting-environment-variables-secrets
.envファイルとかではなく?
getenv()は非推奨?
https://github.com/symfony/symfony/issues/35388
---------------------------------------
PostgreSQL 10以降では、IDENTITY列を使用することが推奨
PostgreSQLでは、自動採番を行うために主に2つの方法があります。これらは、SERIAL型とIDENTITY列