0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

PHP Laravel 開発環境構築 mac

Posted at

目的

PHP Laravelの開発環境を作ってみる。

ゴール

新規プロジェクトを作って開発サーバをrunする

php のinstallをしたい

とりあえずターゲットを知りたいのでコマンドを叩く

~ $ brew search php
Error: Permission denied @ rb_sysopen - /private/tmp/github_api_headers20220426-3375-wye0ru

む??、権限。。。設定しなおして再実行
でけた

~ $ brew search php
brew-php-switcher   php@7.2             phplint             pcp
php                 php@7.3             phpmd               pup
php-code-sniffer    php@7.4             phpmyadmin
php-cs-fixer        php@8.0             phpstan
php-cs-fixer@2      phpbrew             phpunit

ふむ。参照させていただいているページにあわせて 7.2 でいってみる

~ $ brew install php@7.2
Error: php@7.2 has been disabled because it is deprecated upstream!

むむ?? 無効。。。

ほんじゃ、8.0で

~ $ brew install php@8.0
・・・省略・・・

~ $ php -v
-bash: php: command not found

むむむ? PATHか。~/.bash_profile を書き換えて

~ $ php -v
PHP 8.0.18 (cli) (built: Apr 15 2022 09:41:02) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.18, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.18, Copyright (c), by Zend Technologies

ok

composer(パッケージ管理システム)のinstall

~ $ composer --version
Composer version 2.3.5 2022-04-13 16:43:00

ok

laravel project の作成

php-sample $ composer create-project laravel/laravel .
Creating a "laravel/laravel" project at "./"
・・・省略・・・
Publishing complete.
> @php artisan key:generate --ansi
Application key set successfully.

ok

アプリケーション起動確認

php-sample $ php artisan serve
Starting Laravel development server: http://127.0.0.1:8000

スクリーンショット 2022-04-27 15.28.30.png

でけた。

参考URL

【Mac】Laravelの環境構築手順書(メモ)
composerとは
pkgist
PHP開発でComposerを使わないなんてありえない!基礎編
composer.org

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?