Skip to content

Latest commit

 

History

History
51 lines (35 loc) · 1.79 KB

README.md

File metadata and controls

51 lines (35 loc) · 1.79 KB

Laravel git hooks

Git hooks to improve laravel development and deployment process

Set up pre-commit hook for mix

In order to optimize asset for production automnatically, pre-commit hook can be useful. This pre-commit hook will look for any file change in resource directory and run yarn production.

To set up this hook, enter command bellow in terminal

curl -fsSL https://raw.githubusercontent.com/HazzazBinFaiz/laravel-git-hooks/main/pre-commit > .git/hooks/pre-commit

Set up post-receive hook for server side

In order to update package and optimize laravel app, post-receive hook can be useful. This post-receive hook will look for any change in file named composer and install new packages and it will optimize laravel app by running php artisan optimize.

To set up shared hook, enter command bellow in terminal

Warning: Use with your own risk

curl -fsSL https://raw.githubusercontent.com/HazzazBinFaiz/laravel-git-hooks/main/post-receive-shared > .git/hooks/post-receive

To set up this hook, enter command bellow in terminal

curl -fsSL https://raw.githubusercontent.com/HazzazBinFaiz/laravel-git-hooks/main/post-receive > .git/hooks/post-receive

Initial setup (not hook)

This is not a hook setup, just a helpful script to setup laravel app

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/HazzazBinFaiz/laravel-git-hooks/main/initial_setup.sh)"

Customize php for setup

export PHP=/usr/local/bin/other-php && /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/HazzazBinFaiz/laravel-git-hooks/main/initial_setup.sh)"

Customize composer for setup

export COMPOSER_BIN=/usr/local/bin/composer && /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/HazzazBinFaiz/laravel-git-hooks/main/initial_setup.sh)"