====== PHP自作フレームワーク:Apricotの製作過程 ====== Version 0.9 ([[apricot:license|MIT License]]) --- //[[http://www.y2sunlight.com|y2sunlight]] 2020-03-24// 本章では筆者の自作フレームワークであるApricotの製作過程を紹介します。 Apricotは必要最小限の外部ライブラリ(パッケージ)だけを集めた「[[sampleproj:#ステイプルワーク|ステイプルワーク]]」です。それはアプリケーションによりステイプルワーク自体のカスタマイズを前提としています。ライブラリに含まれていない機能(構成管理、イベントハンドラ、パイプラインやレスポンス処理など)は自作しますが、PHPは本来Webアプリケーションの為の言語なので、その特性を最大限に利用しApricotには極力軽量なコードを実装します。また、ライブラリ間の結合性を「疎」にすることで後で他のライブラリに変更できるように配慮します。 本編では、Apricotの製作過程を示します。Apricotにはユーザ認証とユーザアカウントの編集機能だけが実装されています。手順通りに行えばちょっとしたフレームワークが完成します。「ちょっとしたアプリ」には「ちょっとしたフレームワーク」の方が似合っています。一度作ってしまえば、後の修正は自由自在です。 尚、Apricot (α版)のEclipseによるプロジェクト作成方法と、使用パッケージのComposeによるインストール方法等については、「[[basic-library:top|定番ライブラリ]]」を参照して下さい。 開発環境 * XAMPP 7.3.15 * PHP 7.3.15 (VC15 X86 64bit thread safe) * Eclipse 2019-12 — PHP Windows 64bit版 * Composer 1.10.1 使用パッケージ ^機能^パッケージ名^Vsersion^ |[[basic-library:phpdotenv:4.1|環境変数]]|[[https://github.com/vlucas/phpdotenv|phpdotenv]]|4.1| |[[basic-library:monolog:2.0|ログ出力]]|[[https://github.com/Seldaek/monolog|monolog]]|2.0| |[[basic-library:idiorm:1.5|ORマッパー]]|[[https://github.com/j4mie/idiorm|idiorm]]|1.5| |[[basic-library:bladeone:3.37|テンプレートエンジン]]|[[https://github.com/EFTEC/BladeOne|bladeone]]|3.37| |[[basic-library:fast-route:1.3|リクエストルーター]]|[[https://github.com/nikic/FastRoute|FastRoute]]|1.3| |[[basic-library:league-container:3.3|DIコンテナー]]|[[https://github.com/thephpleague/container|League/Container]]|3.3| |[[basic-library:valitron:1.4|バリデーター]]|[[https://github.com/vlucas/valitron|Valitron]]|1.4| |[[basic-library:whoops:2.7|エラーハンドラー]]|[[https://github.com/filp/whoops|Whoops]]|2.7| |[[basic-library:php-debugbar:1.16|デバッグ出力]]|[[https://github.com/maximebf/php-debugbar|php-debugbar]]|1.16| \\ ===== 目次 ===== * [[apricot:configuration|Apricot プロジェクトの作成]] * [[apricot:public|Apricot 公開フォルダ]] * Apricot コア * [[apricot:core:top|コア作成の準備]] * [[apricot:core:application-class|Apricot アプリケーションクラス]] * [[apricot:core:basic-class|Apricot 各種基本コアクラス]] * [[apricot:core:request-class|Apricot リクエストクラス]] * [[apricot:core:response-class|Apricot レスポンスクラス]] * [[apricot:core:base-controller|Apricot ベースコントローラ]] * [[apricot:core:completion|Apricot コアの完成]] * Apricot アプリ * [[apricot:app:top|Apricot アプリ作成の準備]] * [[apricot:app:home|Apricot ホーム画面]] * [[apricot:app:error|Apricot エラー画面]] * [[apricot:app:db-model|Apricot データベースとモデル]] * [[apricot:app:user-list|Apricot ユーザ一覧画面]] * [[apricot:app:user-edit|Apricot ユーザ登録画面]] * [[apricot:app:validation|Apricot バリデーション]] * [[apricot:app:transaction|Apricot トランザクション]] * Apricot 拡張 * [[apricot:ext:middleware|Apricot ミドルウェア]] * [[apricot:ext:access-log|Apricot アクセスログ]] * [[apricot:ext:csrf|Apricot CSRF対策]] * [[apricot:ext:user-auth|Apricot ユーザ認証]] * [[apricot:ext:basic-auth|Apricot 基本認証]] * [[apricot:ext:session-auth|Apricot セッション認証]] * [[apricot:ext:interceptor|Apricot インターセプター]] * [[apricot:ext:di-container|Apricot DIコンテナー]] \\ ===== Apricot is available on GitHub ===== * [[https://github.com/y2sunlight/apricot|Apricot Framework]] * [[https://github.com/y2sunlight/apricot-skeleton|apricot-skeleton]]
>Apricot(V1.0) published on GitHub and Apricot(0.9) published in this site are different versions. >GitHub公開しているApricot(v1.0)と本編で掲載しているApricot(v0.9)は異なったバージョンです。
==== Documentation ==== * [[https://github.com/y2sunlight/apricot/wiki/Apricot-Document|Apricot 1.0 Document (English)]] * [[apricot:usage:ja|Apricot 1.0 ドキュメント (日本語)]] \\