Develop concrete5 site with valet and make a cli alias to save development time

#

[This article is for beginners only.]

Now a days laravel valet is so popular to web developers for it’s simplicity and easy to use. If you don’t know about valet please take a look on valet documentation

Now valet has environment support for concrete5. You just need to add config files with prefix valet. For example- you work in a team and your project hasa database configuration file in application/config/database.php. But different users has different database name, username, password in your team. So, you can make a file in application/config/valet.database.php and add this path on .gitignore file. Concrete5 is that smart to get this value automatically.

For faster development, you may have to use concrete5 command line interface frequently. If you don’t know about concrete5 command line tool please take a look concrete5 command line interface documentation.

In general, you can get concrete5 all commands list using

concrete/bin/concrete5 list

But, if you use valet configuration, you need to use the following command.

concrete/bin/concrete5 --env=valet list

And I think it’s annoying to use this long command every time. So, I like to use it as a shortcut and for this we just need to make an alias. 

Open your terminal and run the following command to open your .bash_profile.

vim ~/.bash_profile

Press $ to go to the end of the file. Then press i to go into insert mode. 
Paste the following line.

alias concrete5='concrete/bin/concrete5 --env=valet'

Now run-

source ~/.bash_profile

You’re ready to go. Go to your concrete5 project root directory and run 

concrete5 c5:list

Tips: Just type conc and press tab from your keyboard. concrete5 will be automatically filled out.


コメント欄を読み込み中