Skip to content

Instantly share code, notes, and snippets.

@jtgrimes
Last active June 23, 2019 21:09
Show Gist options
  • Save jtgrimes/b9145b8acb1e40e32264c5f55538b7c6 to your computer and use it in GitHub Desktop.
Save jtgrimes/b9145b8acb1e40e32264c5f55538b7c6 to your computer and use it in GitHub Desktop.
Initial setup of a new Laravel project
#!/bin/sh
#install the core
composer create-project --prefer-dist laravel/laravel $1
cd $1
git init
#install extra packages
composer require --dev squizlabs/php_codesniffer barryvdh/laravel-ide-helper doctrine/dbal roave/security-advisories:dev-master laravel/telescope dczajkowski/auth-tests jrmadsen67/laravel-feature-test-generator
php artisan telescope:install
php artisan make:auth
php artisan make:auth-tests --without-email-verification
composer dump
#updates for composer.json
#scripts
sed -i.backup '/scripts/ a "fix-style": "phpcbf -p --standard=PSR2 --runtime-set ignore_errors_on_exit 1 --runtime-set ignore_warnings_on_exit 1 app tests",' composer.json
sed -i.backup '/scripts/ a "check-style": "phpcs -p --standard=PSR2 --runtime-set ignore_errors_on_exit 1 --runtime-set ignore_warnings_on_exit 1 app tests",' composer.json
sed -i.backup '/scripts/ a "test": "phpunit",' composer.json
sed -i.backup '/post-autoload-dump/ a "php artisan ide-helper:generate",' composer.json
sed -i.backup '/post-autoload-dump/ a "php artisan ide-helper:meta",' composer.json
sed -i.backup '/post-autoload-dump/ a "php artisan ide-helper:models",' composer.json
rm composer.json.backup
composer dump
#Clean out the readme file
rm readme.md
touch readme.md
#update our git ignore
echo '.phpstorm.meta.php' >> .gitignore
echo '_ide_helper.php' >> .gitignore
#commit
git add -A
git commit -m "Initial commit"
#TODO
# add Exception classes (unimplementedcode, unreachablecode)
# add build dir, sniffer.xml
# rename project in composer.json
# update phpunit.xml with
# <env name="DB_CONNECTION" value="sqlite"/>
# <env name="DB_DATABASE" value=":memory:"/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment