PHPフレームワーク「Laravel」の開発環境を構築する
PHPのフレームワークとしてよく利用される「Laravel」のインストールに関して解説します。
Composerのインストール
Laravelの導入するにあたり、「Composer」をインストールします。
Composerとは?
ComposerとはPHPのパッケージ管理のプログラムでLaravelはこのComposerを利用し導入します。
Composerをダウンロード
https://getcomposer.org/download/ にアクセスし「composer.phar」をダウンロードします。
ページ内の「Manual Download」下部にあるバージョン部分をクリックすることで任意のバージョンのComposer.pharをダウンロードすることができます。
クリックしダウンロードが完了すると「ダウンロード」ディレクトリで「composer.phar」を確認することができます。
composer.phar をコマンドで移動して配置
次にターミナルを利用して、ダウンロードした「composer.phar」を「/usr/local/bin/composer」に移動します。
あらかじめ、composer.pharがある「Downloads」ディレクトリに移動してから「sudo」を実行してください。
1 2 3 | % cd Downloads % sudo mv composer.phar /usr/local/bin/composer Password: |
指定のディレクトリに「composer」が配置されています。
次にパーミッションの設定を行います。
※パーミッションの設定を行わないとcomposerを実行することができません。
パーミッション変更後「composer -V」でcomposerを実行しバージョンを確認しています。バージョンが表示されれば正常にインストールが完了したことになります。
1 2 3 | % chmod a+x /usr/local/bin/composer % composer -V Composer version 2.0.9 2021-01-27 16:09:27 |
composerのアップデート
すでにcomposerをインストールしている場合はアップデートを行う必要があるかもしれません。
composerのアップデート方法は
1 2 | % composer self-update You are already using the latest available Composer version 2.0.9 (stable channel). |
最新バージョンの場合は「You are already using the latest available Composer version *.*.* (stable channel).」と表示されます。
Laravelのインストール
Composerのインストールが完了したら、いよいよ「Laravel」のインストールを行います。
ターミナルで下記のコマンドを実行することでインストールが自動で始まるのでしばらく待ちます。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | % composer global require laravel/installer Changed current directory to /Users/Satoshi/.composer Using version ^4.1 for laravel/installer ./composer.json has been created Running composer update laravel/installer Loading composer repositories with package information Updating dependencies Lock file operations: 12 installs, 0 updates, 0 removals - Locking laravel/installer (v4.1.1) - Locking psr/container (1.0.0) - Locking symfony/console (v5.2.2) - Locking symfony/polyfill-ctype (v1.22.0) - Locking symfony/polyfill-intl-grapheme (v1.22.0) - Locking symfony/polyfill-intl-normalizer (v1.22.0) - Locking symfony/polyfill-mbstring (v1.22.0) - Locking symfony/polyfill-php73 (v1.22.0) - Locking symfony/polyfill-php80 (v1.22.0) - Locking symfony/process (v5.2.2) - Locking symfony/service-contracts (v2.2.0) - Locking symfony/string (v5.2.2) Writing lock file Installing dependencies from lock file (including require-dev) Package operations: 12 installs, 0 updates, 0 removals - Downloading symfony/polyfill-php80 (v1.22.0) - Downloading symfony/process (v5.2.2) - Downloading symfony/polyfill-mbstring (v1.22.0) - Downloading symfony/polyfill-intl-normalizer (v1.22.0) - Downloading symfony/polyfill-intl-grapheme (v1.22.0) - Downloading symfony/polyfill-ctype (v1.22.0) - Downloading symfony/string (v5.2.2) - Downloading psr/container (1.0.0) - Downloading symfony/service-contracts (v2.2.0) - Downloading symfony/polyfill-php73 (v1.22.0) - Downloading symfony/console (v5.2.2) - Downloading laravel/installer (v4.1.1) - Installing symfony/polyfill-php80 (v1.22.0): Extracting archive - Installing symfony/process (v5.2.2): Extracting archive - Installing symfony/polyfill-mbstring (v1.22.0): Extracting archive - Installing symfony/polyfill-intl-normalizer (v1.22.0): Extracting archive - Installing symfony/polyfill-intl-grapheme (v1.22.0): Extracting archive - Installing symfony/polyfill-ctype (v1.22.0): Extracting archive - Installing symfony/string (v5.2.2): Extracting archive - Installing psr/container (1.0.0): Extracting archive - Installing symfony/service-contracts (v2.2.0): Extracting archive - Installing symfony/polyfill-php73 (v1.22.0): Extracting archive - Installing symfony/console (v5.2.2): Extracting archive - Installing laravel/installer (v4.1.1): Extracting archive 6 package suggestions were added by new dependencies, use `composer suggest` to see details. Generating autoload files 10 packages you are using are looking for funding. Use the `composer fund` command to find out more! |
インストールが完了したら、Laravelのコマンドを利用するため「環境変数PATH」にインストール場所のパスを追記します。
これは一度実行すれば今後設定は不要です。
1 | echo "export PATH=~/.composer/vender/bin:$PATH" >> ~/.bash_profile source ~/.bash_profile |
Laravelを実行する
ではLaravelのプロジェクト「laravelapp」を作成します。
ターミナルで「composer create-project laravel/laravel laravelapp –prefer-dist」を実行すると、Laravelのプロジェクト「laravelapp」の作成が始まります。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 | % composer create-project laravel/laravel laravelapp --prefer-dist Creating a "laravel/laravel" project at "./laravelapp" Installing laravel/laravel (v8.5.9) - Downloading laravel/laravel (v8.5.9) - Installing laravel/laravel (v8.5.9): Extracting archive Created project in /Users/Satoshi/laravelapp > @php -r "file_exists('.env') || copy('.env.example', '.env');" Loading composer repositories with package information Updating dependencies Lock file operations: 105 installs, 0 updates, 0 removals - Locking asm89/stack-cors (v2.0.2) - Locking brick/math (0.9.2) - Locking dnoegel/php-xdg-base-dir (v0.1.1) - Locking doctrine/inflector (2.0.3) - Locking doctrine/instantiator (1.4.0) - Locking doctrine/lexer (1.2.1) - Locking dragonmantank/cron-expression (v3.1.0) - Locking egulias/email-validator (2.1.25) - Locking facade/flare-client-php (1.3.7) - Locking facade/ignition (2.5.9) - Locking facade/ignition-contracts (1.0.2) - Locking fakerphp/faker (v1.13.0) - Locking fideloper/proxy (4.4.1) - Locking filp/whoops (2.9.2) - Locking fruitcake/laravel-cors (v2.0.3) - Locking graham-campbell/result-type (v1.0.1) - Locking guzzlehttp/guzzle (7.2.0) - Locking guzzlehttp/promises (1.4.0) - Locking guzzlehttp/psr7 (1.7.0) - Locking hamcrest/hamcrest-php (v2.0.1) - Locking laravel/framework (v8.25.0) - Locking laravel/sail (v1.3.0) - Locking laravel/tinker (v2.6.0) - Locking league/commonmark (1.5.7) - Locking league/flysystem (1.1.3) - Locking league/mime-type-detection (1.7.0) - Locking mockery/mockery (1.4.2) - Locking monolog/monolog (2.2.0) - Locking myclabs/deep-copy (1.10.2) - Locking nesbot/carbon (2.44.0) - Locking nikic/php-parser (v4.10.4) - Locking nunomaduro/collision (v5.3.0) - Locking opis/closure (3.6.1) - Locking phar-io/manifest (2.0.1) - Locking phar-io/version (3.0.4) - Locking phpdocumentor/reflection-common (2.2.0) - Locking phpdocumentor/reflection-docblock (5.2.2) - Locking phpdocumentor/type-resolver (1.4.0) - Locking phpoption/phpoption (1.7.5) - Locking phpspec/prophecy (1.12.2) - Locking phpunit/php-code-coverage (9.2.5) - Locking phpunit/php-file-iterator (3.0.5) - Locking phpunit/php-invoker (3.1.1) - Locking phpunit/php-text-template (2.0.4) - Locking phpunit/php-timer (5.0.3) - Locking phpunit/phpunit (9.5.1) - Locking psr/container (1.0.0) - Locking psr/event-dispatcher (1.0.0) - Locking psr/http-client (1.0.1) - Locking psr/http-message (1.0.1) - Locking psr/log (1.1.3) - Locking psr/simple-cache (1.0.1) - Locking psy/psysh (v0.10.6) - Locking ralouphie/getallheaders (3.0.3) - Locking ramsey/collection (1.1.3) - Locking ramsey/uuid (4.1.1) - Locking sebastian/cli-parser (1.0.1) - Locking sebastian/code-unit (1.0.8) - Locking sebastian/code-unit-reverse-lookup (2.0.3) - Locking sebastian/comparator (4.0.6) - Locking sebastian/complexity (2.0.2) - Locking sebastian/diff (4.0.4) - Locking sebastian/environment (5.1.3) - Locking sebastian/exporter (4.0.3) - Locking sebastian/global-state (5.0.2) - Locking sebastian/lines-of-code (1.0.3) - Locking sebastian/object-enumerator (4.0.4) - Locking sebastian/object-reflector (2.0.4) - Locking sebastian/recursion-context (4.0.4) - Locking sebastian/resource-operations (3.0.3) - Locking sebastian/type (2.3.1) - Locking sebastian/version (3.0.2) - Locking swiftmailer/swiftmailer (v6.2.5) - Locking symfony/console (v5.2.2) - Locking symfony/css-selector (v5.2.2) - Locking symfony/deprecation-contracts (v2.2.0) - Locking symfony/error-handler (v5.2.2) - Locking symfony/event-dispatcher (v5.2.2) - Locking symfony/event-dispatcher-contracts (v2.2.0) - Locking symfony/finder (v5.2.2) - Locking symfony/http-client-contracts (v2.3.1) - Locking symfony/http-foundation (v5.2.2) - Locking symfony/http-kernel (v5.2.2) - Locking symfony/mime (v5.2.2) - Locking symfony/polyfill-ctype (v1.22.0) - Locking symfony/polyfill-iconv (v1.22.0) - Locking symfony/polyfill-intl-grapheme (v1.22.0) - Locking symfony/polyfill-intl-idn (v1.22.0) - Locking symfony/polyfill-intl-normalizer (v1.22.0) - Locking symfony/polyfill-mbstring (v1.22.0) - Locking symfony/polyfill-php72 (v1.22.0) - Locking symfony/polyfill-php73 (v1.22.0) - Locking symfony/polyfill-php80 (v1.22.0) - Locking symfony/process (v5.2.2) - Locking symfony/routing (v5.2.2) - Locking symfony/service-contracts (v2.2.0) - Locking symfony/string (v5.2.2) - Locking symfony/translation (v5.2.2) - Locking symfony/translation-contracts (v2.3.0) - Locking symfony/var-dumper (v5.2.2) - Locking theseer/tokenizer (1.2.0) - Locking tijsverkoyen/css-to-inline-styles (2.2.3) - Locking vlucas/phpdotenv (v5.3.0) - Locking voku/portable-ascii (1.5.6) - Locking webmozart/assert (1.9.1) Writing lock file Installing dependencies from lock file (including require-dev) Package operations: 105 installs, 0 updates, 0 removals - Downloading doctrine/inflector (2.0.3) - Downloading doctrine/lexer (1.2.1) - Downloading webmozart/assert (1.9.1) - Downloading dragonmantank/cron-expression (v3.1.0) - Downloading symfony/var-dumper (v5.2.2) - Downloading psr/log (1.1.3) - Downloading monolog/monolog (2.2.0) - Downloading voku/portable-ascii (1.5.6) - Downloading phpoption/phpoption (1.7.5) - Downloading graham-campbell/result-type (v1.0.1) - Downloading vlucas/phpdotenv (v5.3.0) - Downloading symfony/css-selector (v5.2.2) - Downloading tijsverkoyen/css-to-inline-styles (2.2.3) - Downloading symfony/deprecation-contracts (v2.2.0) - Downloading symfony/routing (v5.2.2) - Downloading symfony/polyfill-php72 (v1.22.0) - Downloading symfony/polyfill-intl-idn (v1.22.0) - Downloading symfony/mime (v5.2.2) - Downloading symfony/http-foundation (v5.2.2) - Downloading symfony/http-client-contracts (v2.3.1) - Downloading psr/event-dispatcher (1.0.0) - Downloading symfony/event-dispatcher-contracts (v2.2.0) - Downloading symfony/event-dispatcher (v5.2.2) - Downloading symfony/error-handler (v5.2.2) - Downloading symfony/http-kernel (v5.2.2) - Downloading symfony/finder (v5.2.2) - Downloading symfony/polyfill-iconv (v1.22.0) - Downloading egulias/email-validator (2.1.25) - Downloading swiftmailer/swiftmailer (v6.2.5) - Downloading ramsey/collection (1.1.3) - Downloading brick/math (0.9.2) - Downloading ramsey/uuid (4.1.1) - Downloading psr/simple-cache (1.0.1) - Downloading opis/closure (3.6.1) - Downloading symfony/translation-contracts (v2.3.0) - Downloading symfony/translation (v5.2.2) - Downloading nesbot/carbon (2.44.0) - Downloading league/mime-type-detection (1.7.0) - Downloading league/flysystem (1.1.3) - Downloading league/commonmark (1.5.7) - Downloading laravel/framework (v8.25.0) - Downloading filp/whoops (2.9.2) - Downloading facade/ignition-contracts (1.0.2) - Downloading facade/flare-client-php (1.3.7) - Downloading facade/ignition (2.5.9) - Downloading fakerphp/faker (v1.13.0) - Downloading fideloper/proxy (4.4.1) - Downloading asm89/stack-cors (v2.0.2) - Downloading fruitcake/laravel-cors (v2.0.3) - Downloading psr/http-message (1.0.1) - Downloading psr/http-client (1.0.1) - Downloading ralouphie/getallheaders (3.0.3) - Downloading guzzlehttp/psr7 (1.7.0) - Downloading guzzlehttp/promises (1.4.0) - Downloading guzzlehttp/guzzle (7.2.0) - Downloading laravel/sail (v1.3.0) - Downloading nikic/php-parser (v4.10.4) - Downloading dnoegel/php-xdg-base-dir (v0.1.1) - Downloading psy/psysh (v0.10.6) - Downloading laravel/tinker (v2.6.0) - Downloading hamcrest/hamcrest-php (v2.0.1) - Downloading mockery/mockery (1.4.2) - Downloading nunomaduro/collision (v5.3.0) - Downloading phpdocumentor/reflection-common (2.2.0) - Downloading phpdocumentor/type-resolver (1.4.0) - Downloading phpdocumentor/reflection-docblock (5.2.2) - Downloading sebastian/version (3.0.2) - Downloading sebastian/type (2.3.1) - Downloading sebastian/resource-operations (3.0.3) - Downloading sebastian/recursion-context (4.0.4) - Downloading sebastian/object-reflector (2.0.4) - Downloading sebastian/object-enumerator (4.0.4) - Downloading sebastian/global-state (5.0.2) - Downloading sebastian/exporter (4.0.3) - Downloading sebastian/environment (5.1.3) - Downloading sebastian/diff (4.0.4) - Downloading sebastian/comparator (4.0.6) - Downloading sebastian/code-unit (1.0.8) - Downloading sebastian/cli-parser (1.0.1) - Downloading phpunit/php-timer (5.0.3) - Downloading phpunit/php-text-template (2.0.4) - Downloading phpunit/php-invoker (3.1.1) - Downloading phpunit/php-file-iterator (3.0.5) - Downloading theseer/tokenizer (1.2.0) - Downloading sebastian/lines-of-code (1.0.3) - Downloading sebastian/complexity (2.0.2) - Downloading sebastian/code-unit-reverse-lookup (2.0.3) - Downloading phpunit/php-code-coverage (9.2.5) - Downloading doctrine/instantiator (1.4.0) - Downloading phpspec/prophecy (1.12.2) - Downloading phar-io/version (3.0.4) - Downloading phar-io/manifest (2.0.1) - Downloading myclabs/deep-copy (1.10.2) - Downloading phpunit/phpunit (9.5.1) - Installing doctrine/inflector (2.0.3): Extracting archive - Installing doctrine/lexer (1.2.1): Extracting archive - Installing symfony/polyfill-ctype (v1.22.0): Extracting archive - Installing webmozart/assert (1.9.1): Extracting archive - Installing dragonmantank/cron-expression (v3.1.0): Extracting archive - Installing symfony/polyfill-php80 (v1.22.0): Extracting archive - Installing symfony/polyfill-mbstring (v1.22.0): Extracting archive - Installing symfony/var-dumper (v5.2.2): Extracting archive - Installing symfony/polyfill-intl-normalizer (v1.22.0): Extracting archive - Installing symfony/polyfill-intl-grapheme (v1.22.0): Extracting archive - Installing symfony/string (v5.2.2): Extracting archive - Installing psr/container (1.0.0): Extracting archive - Installing symfony/service-contracts (v2.2.0): Extracting archive - Installing symfony/polyfill-php73 (v1.22.0): Extracting archive - Installing symfony/console (v5.2.2): Extracting archive - Installing psr/log (1.1.3): Extracting archive - Installing monolog/monolog (2.2.0): Extracting archive - Installing voku/portable-ascii (1.5.6): Extracting archive - Installing phpoption/phpoption (1.7.5): Extracting archive - Installing graham-campbell/result-type (v1.0.1): Extracting archive - Installing vlucas/phpdotenv (v5.3.0): Extracting archive - Installing symfony/css-selector (v5.2.2): Extracting archive - Installing tijsverkoyen/css-to-inline-styles (2.2.3): Extracting archive - Installing symfony/deprecation-contracts (v2.2.0): Extracting archive - Installing symfony/routing (v5.2.2): Extracting archive - Installing symfony/process (v5.2.2): Extracting archive - Installing symfony/polyfill-php72 (v1.22.0): Extracting archive - Installing symfony/polyfill-intl-idn (v1.22.0): Extracting archive - Installing symfony/mime (v5.2.2): Extracting archive - Installing symfony/http-foundation (v5.2.2): Extracting archive - Installing symfony/http-client-contracts (v2.3.1): Extracting archive - Installing psr/event-dispatcher (1.0.0): Extracting archive - Installing symfony/event-dispatcher-contracts (v2.2.0): Extracting archive - Installing symfony/event-dispatcher (v5.2.2): Extracting archive - Installing symfony/error-handler (v5.2.2): Extracting archive - Installing symfony/http-kernel (v5.2.2): Extracting archive - Installing symfony/finder (v5.2.2): Extracting archive - Installing symfony/polyfill-iconv (v1.22.0): Extracting archive - Installing egulias/email-validator (2.1.25): Extracting archive - Installing swiftmailer/swiftmailer (v6.2.5): Extracting archive - Installing ramsey/collection (1.1.3): Extracting archive - Installing brick/math (0.9.2): Extracting archive - Installing ramsey/uuid (4.1.1): Extracting archive - Installing psr/simple-cache (1.0.1): Extracting archive - Installing opis/closure (3.6.1): Extracting archive - Installing symfony/translation-contracts (v2.3.0): Extracting archive - Installing symfony/translation (v5.2.2): Extracting archive - Installing nesbot/carbon (2.44.0): Extracting archive - Installing league/mime-type-detection (1.7.0): Extracting archive - Installing league/flysystem (1.1.3): Extracting archive - Installing league/commonmark (1.5.7): Extracting archive - Installing laravel/framework (v8.25.0): Extracting archive - Installing filp/whoops (2.9.2): Extracting archive - Installing facade/ignition-contracts (1.0.2): Extracting archive - Installing facade/flare-client-php (1.3.7): Extracting archive - Installing facade/ignition (2.5.9): Extracting archive - Installing fakerphp/faker (v1.13.0): Extracting archive - Installing fideloper/proxy (4.4.1): Extracting archive - Installing asm89/stack-cors (v2.0.2): Extracting archive - Installing fruitcake/laravel-cors (v2.0.3): Extracting archive - Installing psr/http-message (1.0.1): Extracting archive - Installing psr/http-client (1.0.1): Extracting archive - Installing ralouphie/getallheaders (3.0.3): Extracting archive - Installing guzzlehttp/psr7 (1.7.0): Extracting archive - Installing guzzlehttp/promises (1.4.0): Extracting archive - Installing guzzlehttp/guzzle (7.2.0): Extracting archive - Installing laravel/sail (v1.3.0): Extracting archive - Installing nikic/php-parser (v4.10.4): Extracting archive - Installing dnoegel/php-xdg-base-dir (v0.1.1): Extracting archive - Installing psy/psysh (v0.10.6): Extracting archive - Installing laravel/tinker (v2.6.0): Extracting archive - Installing hamcrest/hamcrest-php (v2.0.1): Extracting archive - Installing mockery/mockery (1.4.2): Extracting archive - Installing nunomaduro/collision (v5.3.0): Extracting archive - Installing phpdocumentor/reflection-common (2.2.0): Extracting archive - Installing phpdocumentor/type-resolver (1.4.0): Extracting archive - Installing phpdocumentor/reflection-docblock (5.2.2): Extracting archive - Installing sebastian/version (3.0.2): Extracting archive - Installing sebastian/type (2.3.1): Extracting archive - Installing sebastian/resource-operations (3.0.3): Extracting archive - Installing sebastian/recursion-context (4.0.4): Extracting archive - Installing sebastian/object-reflector (2.0.4): Extracting archive - Installing sebastian/object-enumerator (4.0.4): Extracting archive - Installing sebastian/global-state (5.0.2): Extracting archive - Installing sebastian/exporter (4.0.3): Extracting archive - Installing sebastian/environment (5.1.3): Extracting archive - Installing sebastian/diff (4.0.4): Extracting archive - Installing sebastian/comparator (4.0.6): Extracting archive - Installing sebastian/code-unit (1.0.8): Extracting archive - Installing sebastian/cli-parser (1.0.1): Extracting archive - Installing phpunit/php-timer (5.0.3): Extracting archive - Installing phpunit/php-text-template (2.0.4): Extracting archive - Installing phpunit/php-invoker (3.1.1): Extracting archive - Installing phpunit/php-file-iterator (3.0.5): Extracting archive - Installing theseer/tokenizer (1.2.0): Extracting archive - Installing sebastian/lines-of-code (1.0.3): Extracting archive - Installing sebastian/complexity (2.0.2): Extracting archive - Installing sebastian/code-unit-reverse-lookup (2.0.3): Extracting archive - Installing phpunit/php-code-coverage (9.2.5): Extracting archive - Installing doctrine/instantiator (1.4.0): Extracting archive - Installing phpspec/prophecy (1.12.2): Extracting archive - Installing phar-io/version (3.0.4): Extracting archive - Installing phar-io/manifest (2.0.1): Extracting archive - Installing myclabs/deep-copy (1.10.2): Extracting archive - Installing phpunit/phpunit (9.5.1): Extracting archive 75 package suggestions were added by new dependencies, use `composer suggest` to see details. Generating optimized autoload files > Illuminate\Foundation\ComposerScripts::postAutoloadDump > @php artisan package:discover --ansi Discovered Package: facade/ignition Discovered Package: fideloper/proxy Discovered Package: fruitcake/laravel-cors Discovered Package: laravel/sail Discovered Package: laravel/tinker Discovered Package: nesbot/carbon Discovered Package: nunomaduro/collision Package manifest generated successfully. 74 packages you are using are looking for funding. Use the `composer fund` command to find out more! > @php artisan key:generate --ansi Application key set successfully. |
プロジェクトを実行する
では作成したプロジェクトを実行してみます。
作成したプロジェクトに「cd」で移動し、サーバーを実行します。
1 2 3 | % cd laravelapp laravelapp % php artisan serve Starting Laravel development server: http://127.0.0.1:8000 |
サーバーが実行されたら、ブラウザに「http://127.0.0.1:8000」と入力しアクセスします。
Laravelのトップページが表示されました。
これで正常に実行されていることがわかります。
S.E->お勧め記事;
- XSERVERにSSHを利用してLaravel環境を構築する
- PHPフレームワーク「Laravel」ディレクティブ-分岐処理(条件分岐)-
- PHP フレームワーク Laravel ディレクティブ – ループ変数 $loop –
- macOS Monterey にアップデート後、composerやhomebrewでenv: php: No such file or directoryが出る
- PHPフレームワーク「Laravel」PHPテンプレートを利用する
- PHPフレームワーク「Laravel」MVCとコントローラを利用する
- PHPフレームワーク「Laravel」ディレクティブ-繰り返し処理(ループ処理)-
- Laravel開発環境をgitでコミットする際の注意点
- PHPフレームワーク「Laravel」Bladeテンプレートを利用する