{"id":15307047,"url":"https://github.com/kenjis/codeigniter-tettei-apps","last_synced_at":"2025-04-15T00:28:35.324Z","repository":{"id":31523360,"uuid":"35087824","full_name":"kenjis/codeigniter-tettei-apps","owner":"kenjis","description":"『CodeIgniter徹底入門』のサンプルアプリケーション（CodeIgniter v3.1版） ","archived":false,"fork":false,"pushed_at":"2022-09-30T19:16:46.000Z","size":4108,"stargazers_count":28,"open_issues_count":4,"forks_count":18,"subscribers_count":7,"default_branch":"develop","last_synced_at":"2025-03-28T12:21:15.893Z","etag":null,"topics":["codeception","codeigniter","codeigniter3","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kenjis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"docs/contributing-codeigniter-3.0.0.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-05T08:37:13.000Z","updated_at":"2023-06-20T04:40:24.000Z","dependencies_parsed_at":"2023-01-14T19:15:48.972Z","dependency_job_id":null,"html_url":"https://github.com/kenjis/codeigniter-tettei-apps","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenjis%2Fcodeigniter-tettei-apps","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenjis%2Fcodeigniter-tettei-apps/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenjis%2Fcodeigniter-tettei-apps/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenjis%2Fcodeigniter-tettei-apps/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kenjis","download_url":"https://codeload.github.com/kenjis/codeigniter-tettei-apps/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248983210,"owners_count":21193536,"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","codeigniter3","hacktoberfest","phpunit","selenium","twig"],"created_at":"2024-10-01T08:08:54.236Z","updated_at":"2025-04-15T00:28:35.300Z","avatar_url":"https://github.com/kenjis.png","language":"PHP","readme":"# 『CodeIgniter徹底入門』のサンプルアプリケーションをCodeIgniter 3.xにアップデート\n\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/kenjis/codeigniter-tettei-apps/badges/quality-score.png?b=develop)](https://scrutinizer-ci.com/g/kenjis/codeigniter-tettei-apps/?branch=develop)\n[![Coverage Status](https://coveralls.io/repos/kenjis/codeigniter-tettei-apps/badge.svg?branch=develop)](https://coveralls.io/r/kenjis/codeigniter-tettei-apps?branch=develop)\n[![Build Status](https://travis-ci.org/kenjis/codeigniter-tettei-apps.svg?branch=develop)](https://travis-ci.org/kenjis/codeigniter-tettei-apps)\n\n**現在、CodeIgniterの開発は4.xに移っています。CodeIgniter4にアップグレードした、\u003chttps://github.com/kenjis/ci4-tettei-apps\u003e を参照してください。**\n\nここは『CodeIgniter徹底入門』（翔泳社）に含まれている以下のサンプルアプリケーション（CodeIgniter 1.6.1用）をCodeIgniter 3.xで動作するように更新したものです。\n\n* コンタクトフォーム（7章）\n* モバイル対応簡易掲示板（8章）\n* 簡易ショッピングサイト（9章）\n\nCodeIgniter 3.xで動作するように更新し、少しリファクタリングしました。\n\n## 動作確認環境\n\n### アプリ\n\n* PHP 7.4.15\n  * Composer 1.10.19 (Composer 2.0ではCli for CodeIgniterが動作しません)\n* MySQL 5.7\n\n### 受入テスト\n\n* Selenium Server 3.141.59\n* geckodriver 0.29.0\n* OpenJDK 15.0.1\n\n## 書籍のコードからの変更点\n\n* CodeIgniter 3.1.11に対応（CodeIgniter本体は [CodeIgniter Composer Installer](http://blog.a-way-out.net/blog/2015/12/06/install-codeigniter/) によりComposerでインストール）\n* フォルダ構成を変更し、Web公開領域を`public`フォルダ以下に限定\n* CodeIgniterでComposerを利用可能に設定\n* ISO-2022-JPのメールは作成できなくなったのでUTF-8に変更\n* CSRF対策を独自実装からCodeIgniterの自動保護に変更\n* Codeception/Seleniumによる受入テストの追加 [tests/acceptance](tests/acceptance)\n* PHPUnitによるアプリケーションテストの追加 [application/tests](application/tests)\n* データベースマイグレーションの追加 [application/database/migrations](application/database/migrations)\n* 掲示板\n  * コントローラでの文字エンコード変換ができなくなったのでフックの`pre_system`に移動\n* ショッピング\n  * `category`と`product`テーブルのSeederを追加 [application/database/seeds](application/database/seeds)\n  * キーワード検索をGETメソッドを使うように変更\n  * メール本文の作成をテンプレートパーサクラスを使うように変更\n  * クラスの分割\n  * `MY_Controller`の追加\n  * ビューにTwigを利用\n  * XSS脆弱性の修正\n* リファクタリング\n  * ビューのコーディングスタイルを統一し、HTMLエスケープを徹底\n\n追加されたComposerのパッケージ\n\n* CodeIgniter Simple and Secure Twig \u003chttps://github.com/kenjis/codeigniter-ss-twig\u003e\n* Cli for CodeIgniter \u003chttp://blog.a-way-out.net/blog/2015/05/07/codeigniter-cli/\u003e\n* ci-phpunit-test \u003chttp://blog.a-way-out.net/blog/2015/05/19/ci-phpunit-test/\u003e\n* Faker \u003chttp://blog.a-way-out.net/blog/2014/06/13/faker/\u003e\n* Codeception \u003chttp://codeception.com/\u003e \u003chttp://piccagliani.github.io/Codeception.docs.ja_JP/\u003e\n* Symfony DomCrawler \u003chttp://docs.symfony.gr.jp/symfony2/components/dom_crawler.html\u003e\n* Symfony CssSelector \u003chttp://docs.symfony.gr.jp/symfony2/components/css_selector.html\u003e\n* PHPUnit \u003chttps://phpunit.de/manual/4.8/ja/index.html\u003e\n* CodeIgniter Debug Bar \u003chttps://github.com/kenjis/codeigniter-debugbar\u003e\n\n## インストール方法\n\n### ダウンロード\n\nhttps://github.com/kenjis/codeigniter-tettei-apps/archive/develop.zip をダウンロードし解凍します。\n\n### Apacheの設定\n\n`codeigniter-tettei-apps/public`フォルダが公開フォルダです。ここを \u003chttp://localhost/CodeIgniter/\u003e でアクセスできるように設定してください。\n\n例えば、以下のようにApacheの`htdocs`以下にシンボリックリンクを張ります。\n\n~~~\n$ cd /paht/to/Apache/htdocs/\n$ ln -s /path/to/codeigniter-tettei-apps/public/ CodeIgniter\n~~~\n\nなお、`.htaccess`によるmod_rewriteの設定を有効にしてください。\n\n### ファイルのパーミッション設定\n\n必要な場合は、以下のフォルダにApacheから書き込みできる権限を付与してください。\n\n~~~\n$ cd /path/to/codeigniter-tettei-apps/\n$ chmod o+w application/logs/\n$ chmod o+w application/cache/\n$ chmod o+w public/captcha/\n~~~\n\n### 依存パッケージのインストール\n\nComposerで依存パッケージをインストールします。\n\n~~~\n$ php composer.phar self-update\n$ php composer.phar self-update --1\n$ php composer.phar install --no-plugins\n~~~\n\n#### Note\n\nパッケージをupdateする場合\n\n~~~\n$ php -d memory_limit=-1 composer.phar update --no-plugins\n~~~\n\n### データベースとユーザの作成\n\nMySQLにデータベースとユーザを作成します。\n\n~~~\nCREATE DATABASE `codeigniter` DEFAULT CHARACTER SET utf8mb4;\nGRANT ALL PRIVILEGES ON codeigniter.* TO username@localhost IDENTIFIED BY 'password';\n~~~\n\n### データベースマイグレーションとシーディングの実行\n\nデータベースにテーブルを作成し、テストデータを挿入します。\n\n~~~\n$ php cli migrate\n$ php cli seed\n~~~\n\n## テストの実行方法\n\n### PHPUnitによるアプリケーションテスト\n\n~~~\n$ composer test\n~~~\n\nテストカバー率のレポートは`build/coverage`フォルダに作成されます。なお、カバー率の集計にはXdebugが必要です。\n\n#### Note\n\nRuntimeException: Cannot modify header information - headers already sent by (output started at .../vendor/phpunit/phpunit/src/Util/Printer.php:113) on line 350 ... のようなエラーが出る場合\n\n~~~\n$ vendor/bin/phpunit -c application/tests/ --stderr\n~~~\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-standalone\n$ brew install geckodriver\n~~~\n\nSeleniumサーバを起動します。\n\n~~~\n$ selenium-server -port 4444\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書籍のコードほぼそのままでCodeIgniter 3.0.0に対応したものを見たい場合は、[master](https://github.com/kenjis/codeigniter-tettei-apps/tree/master)ブランチをご覧ください。\n\nまた、具体的な変更点は以下をご覧ください。\n\n* [application/以下のCodeIgniter 3.0へのアップデート](https://github.com/kenjis/codeigniter-tettei-apps/commit/3dcdeefc8e42b2c8f6636fba5e86c7de28f961a3?w=1)\n\n## ライセンス\n\nサンプルアプリケーションのライセンスは「修正BSDライセンス」です。詳細は、[docs/license-codeigniter-tettei-1.4.txt](docs/license-codeigniter-tettei-1.4.txt) をご覧ください。\n\n## 謝辞\n\nサンプルアプリケーションのデザインは、神野みちるさん（株式会社ステップワイズ）にしていただきました。\n\n## 『CodeIgniter徹底入門』について\n\n* [『CodeIgniter徹底入門』情報ページ](http://codeigniter.jp/tettei/)\n* [『CodeIgniter徹底入門』に対するノート](https://github.com/codeigniter-jp/codeigniter-tettei-note)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkenjis%2Fcodeigniter-tettei-apps","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkenjis%2Fcodeigniter-tettei-apps","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkenjis%2Fcodeigniter-tettei-apps/lists"}