One of the fastest dev stacks
Tags: php, laravel
Published: 2020-06-25 23:09:30

This topic is maybe a bit subjective. I think this stack is useful for many but not the fastest at all for everybody. I started "programming" now 9 years ago with the language Basic. Since there, I was fascinated by programming for the web. I started learning ASP.NET because I thought the jump from Visual Basic to ASP.NET couldn't be that big. After tinkering around, I found PHP, and I started loving it. Since there, so many things changed but not my personal conviction that a website or software shouldn't be programmed with more effort than needed. So let's come to the point: What's the fastest stack I figured out and why.

## Laravel
Laravel is an excellent basement. Backed by PHP, a language with 5 million people behind, millions of packages, and tons of tutorials and examples. With Laravel, you have one of the most active communities out there. And I don't want to focus too much on Laravel itself, rather than that I want to put my focus on the speed thing here. You can use tons of plug-and-play packages for so many use-cases: Billing (Cashier), Queue management (Horizon), Debugging (Debugbar, Telescope), etc. Just take a look at my previous post, "Packages I never wanna miss again". All these packages are not like you know packages from Node or other communities. They're the most time with a rich UI, great support, and excellent stability.

## Laravel Schematics / Laravel Blueprint
I have to packages at once here. Both are serving the same target: Code generation for the most frequently created files: Models, Controllers, Migrations. But that's not all: For example, with Laravel Schematics, you can also create a stable database structure and update it on the fly via a beautiful looking UI and relationship management. Just check it out, you can generate CRUD structures with it in minutes.

## Tailwind CSS/UI
I work with tailwind since it's on beta. Since the beginning, it got improved day by day. Also, I purchased "Tailwind UI" immediately, and it wasn't a bad investment. With this set of ready to use components, you can create amazing looking UIs in no time. If you need a beautiful UI in no-time: Use TailwindUI!

## Laravel Nova
If you just want to solve a small data-driven solution or an admin panel, Laravel Nova is the fastest tool you can choose here for laravel. I think it's because of it's intuitive Resource Scheme but also because of the creation process of a solution with it. You can generate a list with multiple filters, bulk actions, a create-form, detail-views, and so much more in minutes. This is so fast because you can manage the UI completely from the code-side. You don't have to do things in a UI or something. 

## Livewire
For the frontend, I often used Vue.js. If you asked a 6 months younger version of mine, I would count vue.js here instead of Livewire. But Livewire is killing it in speed points, syntax, and easiness. With Livewire, you don't have to care about so many things. It's directly serverside, so you don't have to stress with double validations and all the annoying stuff. Of course, you have to get warm with it a bit, but after it, it's amazingly easy and fast to work with. Check out our new Livewire VSCode extension if you want to have some helpers in your editor!

## Never forget artisan
Just as a small hint here: php artisan is your friend. Use it for code-generation, you'll save time, I promise. For example, I create all my controllers, tests, models, migrations, and generally everything with it. It speeds up your development so great!

## Quick external APIs
Often we want to communicate with external APIs to get data from there or post data to it. Many times you don't have a package for it on the market, and also you can't create one for it because you have to hurry. In this case, the fastest way with laravel 7 is the newly introduced Http Facade. Here a small example of a simple API Client class:
``` php
<?php
use \Http;
class SomeServiceClient
{
	public function __construct()
	{
		$this->base_url = config('services.some_service.base_url');
		// And some other configs for auth and so on
	}

	public function get($path)
	{
		return Http::get($this->base_url . $path); // Just add the auth things here
	}
	//....

}
```
Of course, this is just a small example and can be created a bit more extendable. But after all, it works well. (Actually this snipped is not tested)

## Queue/Job architecture scaleable 
One big part of modern web apps is processing jobs in a queue. For performance, it's so necessary to put time-consuming things to the background. For example, sending an email can take some time sporadically. One case could be when the Mailserver is busy or in maintenance. Also, chaining jobs can help. But let me take the queue topic to a dedicated post.

## Deployment: Vapor, Forge and/or Envoyer
In my latest apps, I use vapor quite often. However, sometimes it's not possible because of your architecture or your app is a bit older, and you would have to rewrite all the assets stuff. With vapor, you need do be aware of some architecture things. Maybe also a topic for a dedicated blog post (or perhaps a screencast??) 
If you're in the situation that vapor is not suitable for you, just take Forge. It manages your server stuff for you and allows you to take care of the development, and not your servers. Later if you go live, I highly recommend you use envoyer to manage the deployments. The reason is quite apparent: Your users will not recognize the implementation of new lines of code. 

I hope these hints are not too basic. I just wanted to share with you my favorite stack for developing things fast. I'm really thinking about starting some screencasts (of course for free) to show you more of my way of work. Let me know what you think about this idea on twitter or mail!