{"id":15307048,"url":"https://github.com/kenjis/ci4-tettei-apps","last_synced_at":"2025-07-05T14:39:00.643Z","repository":{"id":43978201,"uuid":"339565676","full_name":"kenjis/ci4-tettei-apps","owner":"kenjis","description":"『CodeIgniter徹底入門』のサンプルアプリケーション （CodeIgniter v4.x版）","archived":false,"fork":false,"pushed_at":"2024-02-19T08:58:38.000Z","size":2348,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"develop","last_synced_at":"2025-06-03T20:15:34.597Z","etag":null,"topics":["codeception","codeigniter","codeigniter4","hacktoberfest","phpunit","selenium","twig"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kenjis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-02-17T00:07:03.000Z","updated_at":"2025-01-05T18:16:43.000Z","dependencies_parsed_at":"2024-02-19T09:55:41.041Z","dependency_job_id":null,"html_url":"https://github.com/kenjis/ci4-tettei-apps","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/kenjis/ci4-tettei-apps","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenjis%2Fci4-tettei-apps","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenjis%2Fci4-tettei-apps/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenjis%2Fci4-tettei-apps/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenjis%2Fci4-tettei-apps/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kenjis","download_url":"https://codeload.github.com/kenjis/ci4-tettei-apps/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenjis%2Fci4-tettei-apps/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263756709,"owners_count":23506582,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["codeception","codeigniter","codeigniter4","hacktoberfest","phpunit","selenium","twig"],"created_at":"2024-10-01T08:08:54.254Z","updated_at":"2025-07-05T14:39:00.609Z","avatar_url":"https://github.com/kenjis.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 『CodeIgniter徹底入門』のサンプルアプリケーションをCodeIgniter4にアップデート\n\nここは『CodeIgniter徹底入門』（翔泳社）に含まれている以下のサンプルアプリケーション（CodeIgniter 1.6.1用）を [CodeIgniter 3.xで動作するように更新したもの](https://github.com/kenjis/codeigniter-tettei-apps) を、CodeIgniter4で動作するように更新するためのプロジェクトです（作業中）。\n\n- コンタクトフォーム（7章）\n- モバイル対応簡易掲示板（8章）\n- 簡易ショッピングサイト（9章）\n\n現在、CodeIgniter 4.xで動作するための更新は完了しており、リファクタリングなどを実施中です。\n\nリファクタリング前のコードは、[v4.0.0](https://github.com/kenjis/ci4-tettei-apps/releases/tag/v4.0.0) を参照してください。\n\n\u003cimg src=\"docs/img/01-home.png\" alt=\"Screenshot: Home\" width=\"400\"\u003e\u003cimg src=\"docs/img/02-form.png\" alt=\"Screenshot: Form\" width=\"400\"\u003e\n\u003cimg src=\"docs/img/03-bbs.png\" alt=\"Screenshot: BBS\" width=\"400\"\u003e\u003cimg src=\"docs/img/04-shop.png\" alt=\"Screenshot: Shop\" width=\"400\"\u003e\n\n## 動作確認環境\n\n### アプリ\n\n- CodeIgniter 4.4.5 ([ci4-app-template](https://github.com/kenjis/ci4-app-template) を使用)\n- PHP 8.2.16\n  - Composer 2.7.1\n- MySQL 8.0.34\n\n### 受入テスト\n\n- selenium-server 4.17.0\n- geckodriver 0.34.0\n\n## 「CodeIgniter 3.xで動作するように更新したもの」からの変更点\n\n- アプリケーションクラスを名前空間付きに移行\n- 自動ルーティングをオフに変更\n  - ルーティング設定はコントローラのアトリビュートから設定ファイルを生成\n- 設定ファイルを設定クラスに移行 \n  - `app/Config/ConfigShop.php`\n- ページネーション\n  - 仕様変更に伴い最初のページもURIセグメント数が変わらないものに変更\n  - offsetベースからページ番号に移行\n  - ページネーションのHTMLをテンプレートに移行\n    - `App\\Views\\Pager\\default_full`\n- バリデーション\n  - Callableの検証ルールをクラスに移行\n    - `App\\Libraries\\Validation\\CaptchaRules`\n  - バリデーションエラーのHTMLをテンプレートに移行\n    - `App\\Views\\Validation\\list`\n    - `App\\Views\\Validation\\single`\n- モバイル掲示板用のフックをコントローラフィルタに移行\n  - `App\\Filters\\ConvertEncoding`\n- アプリケーション用の例外クラスを追加\n- テストケースクラスを名前空間付きに移行\n- 受入テスト用にacceptance環境を追加\n  - `app/Config/Boot/acceptance.php`\n- Composerパッケージの更新\n  - Twigライブラリをcodeigniter-ss-twig v4.0に更新\n  - PHPUnitを9.5に更新\n  - symfony/dom-crawlerを5.2に更新\n  - symfony/css-selectorを5.2に更新\n- GitHub Actionsによるチェックの追加\n  - コーディング標準\n  - PHPUnit\n  - 静的解析\n\n追加されたComposerのパッケージ\n\n- CodeIgniter 3 to 4 Upgrade Helper \u003chttps://github.com/kenjis/ci3-to-4-upgrade-helper\u003e\n- Ray.Di \u003chttps://github.com/Ray-Di/Ray.Di\u003e\n- CodeIgniter4 Attribute Routes \u003chttps://github.com/kenjis/ci4-attribute-routes\u003e\n- PHPUnit Helper \u003chttps://github.com/kenjis/phpunit-helper\u003e\n\n## インストール方法\n\n### ダウンロード\n\nhttps://github.com/kenjis/ci4-tettei-apps/archive/develop.zip をダウンロードし解凍します。\n\n### .envファイルの作成\n\n```\n$ cp env .env\n```\n\n### 依存パッケージのインストール\n\nComposerの依存パッケージをインストールします。\n\n```\n$ composer install\n```\n\n### データベースとユーザーの作成\n\nMySQLにデータベースとユーザーを作成します。\n\n```\nCREATE DATABASE `codeigniter` DEFAULT CHARACTER SET utf8mb4;\nCREATE USER username@localhost IDENTIFIED WITH mysql_native_password BY 'password';\nGRANT ALL PRIVILEGES ON codeigniter.* TO username@localhost;\n```\n\n### データベースマイグレーションとシーディングの実行\n\nデータベースにテーブルを作成し、テストデータを挿入します。\n\n```\n$ php spark migrate\n$ php spark db:seed ProductSeeder\n```\n\n## Webサーバーの起動方法\n\n```\n$ php spark serve\n```\n\n## テストの実行方法\n\n### PHPUnitによるアプリケーションテスト\n\n```\n$ composer test\n```\n\nテストカバー率のレポートを生成したい場合は、以下を実行します。カバー率の集計にはXdebugが必要です。\n\n```\n$ composer coverage\n```\n\nレポートは`build/coverage`フォルダに作成されます。\n\n### Codeception/Seleniumによる受入テスト\n\n\u003chttps://www.mozilla.org/ja/firefox/new/\u003e よりFirefoxをダウンロードしインストールします。\n\nHomebrewからselenium-server-standaloneとgeckodriverをインストールします。\n\n~~~\n$ brew install selenium-server\n$ brew install geckodriver\n~~~\n\nSeleniumサーバを起動します。\n\n~~~\n$ selenium-server standalone\n~~~\n\n受入テストを実行します。\n\n~~~\n$ sh acceptance-test.sh\n~~~\n\n#### Note\n\ngeckodriverが開けない場合は、一度Finderからgeckodriverを右クリックして開いてください。\n\n参考: https://github.com/mozilla/geckodriver/issues/1629#issuecomment-650432816\n\n## ライセンス\n\nサンプルアプリケーションのライセンスは「修正BSDライセンス」です。詳細は、[LICENSE.md](LICENSE.md) をご覧ください。\n\n## 謝辞\n\nサンプルアプリケーションのデザインは、神野みちるさん（株式会社ステップワイズ）にしていただきました。\n\n## 『CodeIgniter徹底入門』について\n\n- [『CodeIgniter徹底入門』のサンプルアプリケーションをCodeIgniter 3.xにアップデート](https://github.com/kenjis/codeigniter-tettei-apps)\n- [『CodeIgniter徹底入門』情報ページ](http://codeigniter.jp/tettei/)\n- [『CodeIgniter徹底入門』に対するノート](https://github.com/codeigniter-jp/codeigniter-tettei-note)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkenjis%2Fci4-tettei-apps","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkenjis%2Fci4-tettei-apps","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkenjis%2Fci4-tettei-apps/lists"}