{"id":502,"date":"2026-07-06T19:04:59","date_gmt":"2026-07-06T10:04:59","guid":{"rendered":"https:\/\/www.marchboy.xyz\/wordpress\/archives\/502"},"modified":"2026-07-06T19:04:59","modified_gmt":"2026-07-06T10:04:59","slug":"codeigniter4%e3%81%ae%e3%81%8a%e3%81%97%e3%82%83%e3%82%8c%e3%81%aa%e4%bd%bf%e3%81%84%e6%96%b9","status":"publish","type":"post","link":"https:\/\/www.marchboy.xyz\/wordpress\/archives\/502","title":{"rendered":"CodeIgniter4\u306e\u304a\u3057\u3083\u308c\u306a\u4f7f\u3044\u65b9"},"content":{"rendered":"<h2>CodeIgniter4\u3068\u306f<\/h2>\n<p>CodeIgniter4\u306f\u3001\u8efd\u91cf\u304b\u3064\u9ad8\u901f\u306aPHP\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3067\u3059\u3002<strong>\u30b7\u30f3\u30d7\u30eb\u306a\u69cb\u9020<\/strong>\u3068<strong>\u8c4a\u5bcc\u306a\u6a5f\u80fd<\/strong>\u3092\u517c\u306d\u5099\u3048\u3066\u304a\u308a\u3001\u30e2\u30c0\u30f3\u306aWeb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u958b\u767a\u306b\u6700\u9069\u3067\u3059\u3002<\/p>\n<h2>\u304a\u3057\u3083\u308c\u306b\u958b\u767a\u3059\u308b\u305f\u3081\u306e\u30dd\u30a4\u30f3\u30c8<\/h2>\n<h3>1. \u540d\u524d\u7a7a\u9593\u3068\u30aa\u30fc\u30c8\u30ed\u30fc\u30c7\u30a3\u30f3\u30b0\u3092\u6d3b\u7528\u3057\u3088\u3046<\/h3>\n<p>PHP7\u4ee5\u964d\u306e\u540d\u524d\u7a7a\u9593\u3092\u30d5\u30eb\u6d3b\u7528\u3059\u308b\u3068\u3001\u30af\u30e9\u30b9\u69cb\u6210\u304c\u3059\u3063\u304d\u308a\u3057\u307e\u3059\u3002<strong>PSR-4<\/strong>\u306b\u5f93\u3063\u305f\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u69cb\u6210\u306b\u3059\u308c\u3070\u3001<code>app\/Controllers<\/code>\u3084<code>app\/Models<\/code>\u306e\u30af\u30e9\u30b9\u306f\u81ea\u52d5\u7684\u306b\u30ed\u30fc\u30c9\u3055\u308c\u307e\u3059\u3002<\/p>\n<pre><code>namespace App\\Controllers;\n\nuse CodeIgniter\\Controller;\n\nclass Home extends Controller\n{\n    public function index()\n    {\n        return view('welcome_message');\n    }\n}\n<\/code><\/pre>\n<h3>2. \u30d3\u30e5\u30fc\u306f\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u30a8\u30f3\u30b8\u30f3\u3067\u6d17\u7df4\u3055\u305b\u308b<\/h3>\n<p>CodeIgniter4\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u3067<code>View<\/code>\u30d8\u30eb\u30d1\u30fc\u3092\u63d0\u4f9b\u3057\u3066\u3044\u307e\u3059\u304c\u3001<strong>Blade<\/strong>\u3084<strong>Twig<\/strong>\u3068\u3044\u3063\u305f\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u30a8\u30f3\u30b8\u30f3\u3092\u5c0e\u5165\u3059\u308b\u3068\u3001HTML\u304c\u683c\u6bb5\u306b\u8aad\u307f\u3084\u3059\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n<h3>3. \u30a2\u30bb\u30c3\u30c8\u7ba1\u7406\u306fCDN\u3068\u30d3\u30eb\u30c9\u30c4\u30fc\u30eb\u3067\u30b9\u30de\u30fc\u30c8\u306b<\/h3>\n<p>Bootstrap\u3084Font Awesome\u306a\u3069\u306e\u5916\u90e8\u30e9\u30a4\u30d6\u30e9\u30ea\u306fCDN\u304b\u3089\u8aad\u307f\u8fbc\u3080\u3060\u3051\u3067OK\u3067\u3059\u3002\u307e\u305f\u3001<code>npm<\/code>\u3084<code>Vite<\/code>\u3092\u7d44\u307f\u5408\u308f\u305b\u308b\u3068\u3001CSS\/JS\u306e\u30d3\u30eb\u30c9\u304c\u81ea\u52d5\u5316\u3055\u308c\u307e\u3059\u3002<\/p>\n<pre><code><!-- Bootstrap CDN -->\n<link href=\"https:\/\/cdn.jsdelivr.net\/npm\/bootstrap@5.3.2\/dist\/css\/bootstrap.min.css\" rel=\"stylesheet\">\n<script src=\"https:\/\/cdn.jsdelivr.net\/npm\/bootstrap@5.3.2\/dist\/js\/bootstrap.bundle.min.js\"><\/script>\n<\/code><\/pre>\n<h3>4. \u30ab\u30b9\u30bf\u30e0\u30d8\u30eb\u30d1\u30fc\u3067\u30b3\u30fc\u30c9\u3092DRY\u306b<\/h3>\n<p>\u5171\u901a\u51e6\u7406\u306f\u30d8\u30eb\u30d1\u30fc\u95a2\u6570\u3068\u3057\u3066\u5207\u308a\u51fa\u3059\u3068\u3001\u30d3\u30e5\u30fc\u3084\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u3067\u7c21\u6f54\u306b\u547c\u3073\u51fa\u305b\u307e\u3059\u3002<\/p>\n<pre><code>\/\/ app\/Helpers\/custom_helper.php\nif (!function_exists('asset_url')) {\n    function asset_url(string $path): string\n    {\n        return base_url('assets\/' . ltrim($path, '\/'));\n    }\n}\n<\/code><\/pre>\n<h3>5. \u30ed\u30ae\u30f3\u30b0\u3068\u30c7\u30d0\u30c3\u30b0\u3067\u5b89\u5168\u6027\u3092\u78ba\u4fdd<\/h3>\n<p>\u958b\u767a\u6642\u306f<code>.env<\/code>\u3067 <strong>CI_ENVIRONMENT<\/strong> \u3092 <code>development<\/code> \u306b\u8a2d\u5b9a\u3057\u3001<code>log_threshold<\/code> \u3092\u4e0a\u3052\u3066\u304a\u304f\u3068\u3001\u30a8\u30e9\u30fc\u60c5\u5831\u304c\u8a73\u7d30\u306b\u53d6\u5f97\u3067\u304d\u307e\u3059\u3002<\/p>\n<ul>\n<li>\u30a8\u30e9\u30fc\u30ed\u30b0\u306f <code>writable\/logs<\/code> \u306b\u51fa\u529b<\/li>\n<li>\u30c7\u30d0\u30c3\u30b0\u30c4\u30fc\u30eb\u30d0\u30fc\u306f <code>app\/Config\/Toolbar.php<\/code> \u3067\u6709\u52b9\u5316<\/li>\n<\/ul>\n<h2>\u307e\u3068\u3081<\/h2>\n<p>CodeIgniter4\u306f\u300c\u8efd\u5feb\u3055\u300d\u3068\u300c\u62e1\u5f35\u6027\u300d\u3092\u517c\u306d\u5099\u3048\u305f\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3067\u3059\u3002\u540d\u524d\u7a7a\u9593\u306e\u6d3b\u7528\u3001\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u30a8\u30f3\u30b8\u30f3\u306e\u5c0e\u5165\u3001CDN\u3068\u30d3\u30eb\u30c9\u30c4\u30fc\u30eb\u3067\u306e\u30a2\u30bb\u30c3\u30c8\u7ba1\u7406\u3001\u30ab\u30b9\u30bf\u30e0\u30d8\u30eb\u30d1\u30fc\u306b\u3088\u308bDRY\u5316\u3001\u305d\u3057\u3066\u30ed\u30ae\u30f3\u30b0\u30fb\u30c7\u30d0\u30c3\u30b0\u306e\u5fb9\u5e95\u3068\u3044\u3063\u305f\u30dd\u30a4\u30f3\u30c8\u3092\u62bc\u3055\u3048\u308b\u3060\u3051\u3067\u3001\u898b\u305f\u76ee\u3082\u30b3\u30fc\u30c9\u3082\u304a\u3057\u3083\u308c\u306aWeb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u4f5c\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>CodeIgniter4\u3068\u306f CodeIgniter4\u306f\u3001\u8efd\u91cf\u304b\u3064\u9ad8\u901f\u306aPHP\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3067\u3059\u3002\u30b7\u30f3\u30d7\u30eb\u306a\u69cb\u9020\u3068\u8c4a\u5bcc\u306a\u6a5f\u80fd\u3092\u517c\u306d\u5099\u3048\u3066\u304a\u308a\u3001\u30e2\u30c0\u30f3\u306aWeb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u958b\u767a\u306b\u6700\u9069\u3067\u3059\u3002 \u304a\u3057\u3083\u308c\u306b\u958b\u767a\u3059\u308b\u305f\u3081\u306e\u30dd\u30a4\u30f3 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"class_list":["post-502","post","type-post","status-publish","format-standard","hentry","category-codeigniter"],"_links":{"self":[{"href":"https:\/\/www.marchboy.xyz\/wordpress\/wp-json\/wp\/v2\/posts\/502","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.marchboy.xyz\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.marchboy.xyz\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.marchboy.xyz\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.marchboy.xyz\/wordpress\/wp-json\/wp\/v2\/comments?post=502"}],"version-history":[{"count":0,"href":"https:\/\/www.marchboy.xyz\/wordpress\/wp-json\/wp\/v2\/posts\/502\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.marchboy.xyz\/wordpress\/wp-json\/wp\/v2\/media?parent=502"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.marchboy.xyz\/wordpress\/wp-json\/wp\/v2\/categories?post=502"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.marchboy.xyz\/wordpress\/wp-json\/wp\/v2\/tags?post=502"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}