What the F*ck Is With All the Artisan Commands: Development Helpers
Here are two useful commands that you can use every day and one that’s good for getting yourself setup.
serve
Why It Exists
The serve
command exists to wrap the built in PHP development server so you can use it to develop your Laravel application.
Now you can access your application by visiting http://127.0.0.1:8000 in your browser.
When Should You Use It
The build in web server is an awesome tool if you don’t need the more complex setup that Laravel Homestead or a custom VM would provide.
tinker
The tinker
command provides an interactive tool to interact with your application.
When you’re inside tinker
you can enter any command you would like and it will be executed using your application’s classes. You can even do crazy things like persist data to the database.
Why It Exists
To provide a place to run quick commands and interact with your data using eloquent.
When Should You Use It
Any time you need to quickly run a command to interact with your data or want to search for something and then use Collections to interact with the data.
preset
Why It Exists
The preset
command allows you to quickly change the front-end scaffolding for your application. It allows you to switch between using none, bootstrap, vue, and react.
For example, if we run this with the “bootstrap” option:
Then we can look at what has changed and see it’s added bootstrap’s files and settings to our “package.json” file:
And our “app.scss” file:
We can also do this for “vue” as well to see what’s changed.
As you can see it’s added a lot more JS.
When Should You Use It
When you’re initially setting up your application. I imagine if you ran this after you’ve already developed some code it would make your life miserable.
Hopefully this has been as helpful to you as it has to me and check back soon for more artisan commands.
Scott Keck-Warren
Scott is the Director of Technology at WeCare Connect where he strives to provide solutions for his customers needs. He's the father of two and can be found most weekends working on projects around the house with his loving partner.
Top Posts
- Working With Soft Deletes in Laravel (By Example)
- Fixing CMake was unable to find a build program corresponding to "Unix Makefiles"
- Upgrading to Laravel 8.x
- Get The Count of the Number of Users in an AD Group
- Multiple Vagrant VMs in One Vagrantfile
- Fixing the "this is larger than GitHub's recommended maximum file size of 50.00 MB" error
- Changing the Directory Vagrant Stores the VMs In
- Accepting Android SDK Licenses From The OSX Command Line
- Fixing the 'Target class [config] does not exist' Error
- Using Rectangle to Manage MacOS Windows
More In This Series
- Intro
- make:migration
- migrate
- Quickies
- Development Helpers
- Make Test
- Factories
- Seeders
- Route Commands
- Queues
- Make:Component
- Test
- Schedules