Have you ever been late on a project delivery? Yeah, I know that stress feeling. At QuickAdminPanel, we see our mission as helping developers to deliver projects quicker. There are many ways to save valuable hours, generating or reusing existing code instead of writing it from scratch. In this article, I will share the tools and processes that helped me in my own Laravel developer journey, to deliver quicker.


Part 1/3. Inside of Laravel

What tools do we have in the framework itself that can help us to code faster?

1. Learn Artisan commands and their parameters

Of course, you are familiar with Artisan commands. But I see a lot of developers stop at only basic commands like artisan make:model or artisan migrate. There are many more – just run this:

php artisan list

For example, there are 21 different make:xxxxx commands:

It’s not only about commands. Most of them have flags, parameters and options, which are not always documented officially.

For example, did you know that make:model User -m would generate migration class, -c would also generate controller, and -a would add a Factory class to all of that?

We have a special article about these: List of 21 Artisan Make Commands with Parameters [Updated Oct 2019]

The best way to find the exact parameters and their values is to read the official Laravel code, it’s available on Github, just browse to framework/src/Illuminate/Foundation/Console/ folder:

Laravel artisan commands

For example, while browsing those files on Github, we may find out that php artisan down has three possible options: –message, –retry and –allow:

Laravel artisan down


2. Use Artisan Tinker

This one is one of the most underused parts of Laravel, in my opinion. With Tinker, you can quickly run some code snippet on your existing project, without creating a special route or controller.

For example, if you want to check the first user’s email address, here’s an example:

php artisan tinker
$user = User::first(); echo $user->email;

Laravel artisan tinker

Or, a better example – want to create a new user from Terminal? Here’s my video using Tinker:


3. Read the Docs

I know, I know, sounds obvious. But my point here is that Laravel documentation got better and better over the years, adding more practical examples of the features.

At the time of writing, Laravel documentation repository has 1,347 contributors, with last file been updated just an hour ago:

laravel documentation repository

So it’s totally worth it to read those long pages of documentation. You will find how to cut corners on many things, like:

Random example – did you know about Blade @error directive?

Laravel blade error directive


Part 2/3. Laravel Code Generators Packages

Any of you remember the days when Jeffrey Way created his mega-popular generators package? It’s not updated anymore, but now there are dozens of generators available, including our QuickAdminPanel.

4. CRUD/AdminPanel Generators

CRUDs are probably the most typical and standard part of the code, so it is relatively easy to automate that part with templates and stubs. And a lot of people actually did it.

Two years ago I’ve written this article on Laravel News: 13 Laravel Admin Panel Generators

Since then, some of those packages were abandoned, some grew even stronger, and some new appeared. I’m happy to mention despite them being our direct competitors, they are all doing great job:

And others.

My tip about them, is that you don’t necessarily need to use their full generator – just use some command or function to generate the part of your application you need, and then copy-paste the code or full files. Even that may save you precious minutes.


5. Database Generators

Did you know you can generate seeds from your existing database? For that, I recommend iSeed package, here’s my demo video:

Also, you can generate migrations from the existing database. Unfortunately, very popular Xethron Migrations Generator seems to be abandoned, but there is a working Sequel Pro extension to do that.

Finally, you can generate visual DB schema from your existing database. I have a video on how to do it with MySQL Workbench:

Also there’s old Laravel Schema Designer, which doesn’t get new functions but is still very good:

Laravel Schema Designer


6. API Documentation Generators

If you have a project with API, documentation is hugely important. And there are two tools to generate it automatically, from the Docblock comments.

Laravel API documentation

The example above is generated by APIDoc Generator package, created by Marcel Pociot.

Another way to generate API docs is to use format called OpenAPI (ex-Swagger). And there’s a Laravel package called L5-Swagger (don’t worry about the name, it supports Laravel 6, too), which is actually a wrapper of a few other PHP packages.

Many developers think it’s really inconvenient to write such big annotations and that they make code less readable, but from experience on a few projects – good API docs are much more valuable in the long run, so it’s totally worth doing it.


7. Factories and Tests Generators

I’ve found two tools to help you generate automated tests.
First, by the same Marcel Pociot, is Laravel Test Factory Helper, which can generate this factory from your existing model:

$factory->define(App\User::class, function (Faker\Generator $faker) {
    return [
        'name' => $faker->name,
        'username' => $faker->userName,
        'email' => $faker->safeEmail,
        'password' => bcrypt($faker->password),
        'company_id' => function () {
            return factory(App\Company::class)->create()->id;
        },
        'remember_token' => Str::random(10),
    ];
});

Also you can generate tests, too, automatically, and that is a service offered by Laravel Shift.
As one of their Shift Packages, they have Laravel Tests Generator for $15.

Laravel tests generator

To be honest, I haven’t tried it myself (on my to-do list to shoot a video about it) so can’t recommend personally, but I’ve used version upgrades with Laravel Shift, and it works like magic, so I expect high standards from those tests, too.


Part 3/3. Know your IDE

Finally, what saves the most time daily on small operations is just how much automation is inside of your IDE, like PhpStorm, Sublime Text, VS Code or whatever you use.

First, I recommend to install Laravel IDE helper no matter what. This package generates a file that your IDE understands, so it can provide accurate autocompletion. It’s just a no-brainer, saving so much time.

Next, I suggest to read the docs of your IDE, related to Laravel framework specifically. For example, PhpStorm has quite a big page about Laravel supported things.

Within PhpStorm universe, I highly recommend Laravel Live Templates plugin.

And, generally, the more keyboard shortcuts and tricks you know about your IDE, the more time you will save over the long years of your career. Those seconds do add up, PhpStorm even saves the statistics of how much time it has saved me:

PhpStorm Productivity guide


So, I guess, that’s it for this article. Of course, there are many more tools and tips to speed up your development, I’ve just shared the most obvious ones I personally used. Feel free to add more in the comments below!

Or discuss on Twitter: