<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Chris Wolf</title>
    <description>The latest articles on DEV Community by Chris Wolf (@laramate).</description>
    <link>https://dev.to/laramate</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F293773%2F34753446-37f0-4bfe-b0e7-0260ba7bd882.jpeg</url>
      <title>DEV Community: Chris Wolf</title>
      <link>https://dev.to/laramate</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/laramate"/>
    <language>en</language>
    <item>
      <title>Scaling Laravel Applications with Octane</title>
      <dc:creator>Chris Wolf</dc:creator>
      <pubDate>Fri, 30 Sep 2022 07:32:09 +0000</pubDate>
      <link>https://dev.to/laramate/scaling-laravel-applications-with-octane-4dp6</link>
      <guid>https://dev.to/laramate/scaling-laravel-applications-with-octane-4dp6</guid>
      <description>&lt;p&gt;Laravel Octane is a high performance HTTP server built on top of the Laravel framework. It provides a simple, elegant way to scale Laravel applications. Octane uses Swoole, Roadrunner or FrankenPHP as its underlying engine, so it's able to handle thousands of concurrent connections with ease.&lt;/p&gt;

&lt;p&gt;There are many benefits to using Octane, such as improved performance, reduced resource usage, and the ability to scale horizontally. However, there are also some caveats to be aware of before using Octane in production. In this article, we'll discuss the opportunities, benefits and caveats of using Laravel Octane to scale a Laravel application.&lt;/p&gt;

&lt;h2&gt;
  
  
  TL;DR
&lt;/h2&gt;

&lt;p&gt;Laravel Octane is a high performance HTTP server built on top of the Laravel framework. Octane uses Swoole or Roadrunner as its underlying engine, so it's able to handle thousands of concurrent connections with ease. There are many benefits to using Octane, such as improved performance, reduced resource usage, and the ability to scale horizontally. But there are also some caveats to be aware of before using it in production. In this article, we'll discuss the opportunities, benefits and caveats of using it to scale a Laravel application.&lt;br&gt;
How does Laravel Octane work?&lt;/p&gt;

&lt;p&gt;Laravel Octane speeds up the serving of Laravel applications. It does that by booting your app once and then keeping it in memory to speed up all subsequent requests. By doing this, the overhead of the Framework is being stripped out.&lt;/p&gt;

&lt;p&gt;Under the hood, it uses Open Swool, Swool, Roadrunner or FrankenPhp to boot the app and serve it.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Swoole and Open Swoole are PHP extensions. They allow your PHP application to handle multiple requests concurrently, which can significantly boost performance for high-traffic websites. However, Swoole requires compiling PHP with the extension, while Open Swoole is a drop-in replacement for easier deployment.&lt;/li&gt;
&lt;li&gt;Roadrunner is a different approach. It's not a PHP extension but a process manager specifically designed for running PHP applications. It acts as a replacement for the standard PHP-FPM (FastCGI Process Manager) and can offer performance improvements without requiring changes to your PHP code.&lt;/li&gt;
&lt;li&gt;FrankenPHP is a relatively new contender. It's another server option for the Laravel Octane framework, designed for high-performance PHP applications. Similar to Swoole and Open Swoole, it utilizes a concurrency model for handling multiple requests simultaneously. FrankenPHP is built on top of the Caddy web server.
Update April 2024: FrankenPHP's Octane integration is in beta and should be used with caution in production.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The difference between Swoole and Open Swoole
&lt;/h2&gt;

&lt;p&gt;Open Swoole is a fork of the Swoole framework, which started in late 2021 because of some disagreement inside the developing community of Swoole.&lt;/p&gt;

&lt;p&gt;Today, Open Swoole has a better documentation but a smaller development team. Which might be to be considered when starting a larger project.&lt;br&gt;
The benefits of using Octane to scale Laravel applications&lt;/p&gt;

&lt;p&gt;Octane speeds up Laravel applications by caching data and objects in memory. So even with no other alterations to hardware or infrastructure, Laravel Octane can improve the performance of your app by up to 30%. This gain is achieved by eliminating the disk reads, process forks, and other overhead associated that happens when the framework is booted up on every request. That way, Octane can handle thousands of concurrent connections with ease. This makes it ideal for applications that receive a lot of traffic or need to be highly available.&lt;/p&gt;

&lt;p&gt;On top on that, this cost-effective way can be expected to be liked by any business, start-up or enterprise.&lt;/p&gt;

&lt;p&gt;In a best-case scenario, you don't even need to make changes to your codebase. But this depends heavily on how your application is structured.&lt;/p&gt;

&lt;h2&gt;
  
  
  Potential caveats of using Laravel Octane
&lt;/h2&gt;

&lt;p&gt;If you're thinking of using Octane to scale your Laravel application, there are a few things to be aware of. Octane is not compatible with all Laravel applications. In particular, it doesn't work with applications that use session state or certain types of middleware. Finally, while Octane can improve performance, it won't necessarily solve all your performance problems. If your application is already struggling to keep up with traffic, Octane may not be enough to save it. In that case, you'll need to consider other options, such as horizontal scaling.&lt;br&gt;
Neccessary refactorings&lt;/p&gt;

&lt;p&gt;If your application uses session state or certain types of middleware, you'll need to make some changes to your code before you can use Octane. In particular, you'll need to add support for Swoole's coroutine-based sessions and remove any middleware that isn't compatible with Swoole.&lt;/p&gt;

&lt;p&gt;Other changes that needs to be made, includes the dependency injection container. I suggest, you check the official laravel documentation on this.&lt;/p&gt;

&lt;h2&gt;
  
  
  How are code changes are handled?
&lt;/h2&gt;

&lt;p&gt;Octane provides a convenient way to automatically watch your codebase for changes and restart the Octane server without any manual interventions. This means that you can make developments more easily by changing codes in one place instead of having to stop/start an entire application instance each time there's something new in your codebase.&lt;br&gt;
Alternatives to Laravel Octane&lt;/p&gt;

&lt;p&gt;Laravel Octane is a great tool for scaling Laravel applications, but it's not the only option. There are other options available that may be more suitable for your needs. Here are some alternatives to consider:&lt;/p&gt;

&lt;h2&gt;
  
  
  More hardware = more performance
&lt;/h2&gt;

&lt;p&gt;Just to mention it, we do not recommend this. This is the easiest, the least cost-effective and the least future-proof method of scaling: Just throw more hardware-performance at your project. This has the obvious downsides of higher running-costs, the need to migrate to different server and the fact that you are not able to scale on demand with this setup.&lt;br&gt;
Nginx Load Balancing with or without AWS&lt;/p&gt;

&lt;p&gt;To build a scalable web application with Laravel on Amazon Web Services, AWS can be used to automatically scale the app to several instances that share one MySQL database. All of these servers would use one Amazon Relational Database Service (RDS).&lt;/p&gt;

&lt;p&gt;Scaling with AWS has been around for some time and it works well. But, it costs can be intransparent. Compared to Octane, this goes with the same principle of how it works, but it is not as effective as Octane would be. A benefit is definetly that you can scale your existing code as-is. No Octane-specific changes needed.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to setup Laravel Octane
&lt;/h2&gt;

&lt;p&gt;For this example, we start with a new Laravel app.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Laravel new octane&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fms2zqgixpenx1x470chn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fms2zqgixpenx1x470chn.png" alt="New Laravel Project setup in CLI" width="800" height="455"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, we install Laravel Octane with FrankenPHP. If FrankenPHP is not yet installed on the system, the artisan Command will handle it for you.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;composer require laravel/octane --dev&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;php artisan octane:install&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2For0wt5y85ycejjpfeqgz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2For0wt5y85ycejjpfeqgz.png" alt="Laravel Octane Installation" width="800" height="441"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Laravel Octane Installation.
&lt;/h3&gt;

&lt;p&gt;Thats all for the installation. Now, we add a couple of measurements to the Laravel app.&lt;/p&gt;

&lt;p&gt;Now, you can start Laravel Octane:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;php artisan octane:start --port=8001&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Use wrk (can be installed via brew) to benchmark Laravel Octane:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;wrk -t4 -c50 http://localhost:8001&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F39zvbdwm15l6jpgqstkw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F39zvbdwm15l6jpgqstkw.png" alt="Laravel Octance Benchmark" width="800" height="470"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Laravel Octane is a great way to scale your Laravel application. It's easy to use and can improve performance without needing to make changes to your codebase. However, it's not compatible with all applications and may not be enough to save an already struggling app. If you're considering using Octane, be sure to do your research and consider all your options before making a decision.&lt;/p&gt;

&lt;p&gt;When you have Laravel Octane in place, watch out for the badge "Laravel Octane Compatible" on packages you add to your project. This means that the package is tested to work with Laravel Octane out of the box and will save you time configuring it to work properly.&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>octane</category>
      <category>scaling</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Laravel vs. Symfony in 2022</title>
      <dc:creator>Chris Wolf</dc:creator>
      <pubDate>Mon, 01 Aug 2022 07:32:00 +0000</pubDate>
      <link>https://dev.to/laramate/laravel-vs-symfony-in-2022-3pdf</link>
      <guid>https://dev.to/laramate/laravel-vs-symfony-in-2022-3pdf</guid>
      <description>&lt;p&gt;When it comes to choosing a PHP framework for web development, there are many factors to consider. Two of the most popular frameworks are Laravel and Symfony. In this blog post, we will compare Laravel and Symfony in terms of their features, performance, and popularity.&lt;/p&gt;

&lt;p&gt;Laravel is a PHP framework that has become increasingly popular in recent years. It is known for its ease of use and flexibility. Laravel is a good choice for small to medium sized projects and, if done right, even for large projects.&lt;/p&gt;

&lt;p&gt;Symfony has been on the market longer than Laravel. It is known for being suitable for larger projects. Symfony is also more complex than Laravel and can be difficult to learn. While Laravel is quite opinionated when it comes to setting up and configuring a project, Symfony holds back and lets developers decide. This can lead to an increased amount of time spent on development.&lt;/p&gt;

&lt;p&gt;In terms of features, both Laravel and Symfony offer a lot. In some places, the differences are quite significant. For example, Laravel offers Eloquent as its ORM, while Symfony uses Doctrine. Another example is that Laravel offers the Blade templating engine, while Symfony uses Twig. &lt;/p&gt;

&lt;p&gt;When it comes to performance, Laravel is generally considered faster than Symfony. However, this is not always the case and it really depends on how the framework is used and configured. In general, both frameworks are quite fast and powerful.&lt;/p&gt;

&lt;h2&gt;
  
  
  Which PHP framework is better for web development projects in 2022 - Laravel or Symfony?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;To answer this question, you should look at these factors:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Community&lt;/li&gt;
&lt;li&gt;Available CMS options&lt;/li&gt;
&lt;li&gt;Ecosystem&lt;/li&gt;
&lt;li&gt;Stability&lt;/li&gt;
&lt;li&gt;Performance&lt;/li&gt;
&lt;li&gt;Development Time&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Community
&lt;/h3&gt;

&lt;p&gt;Laravel has a large and active community. There is extensive documentation on the Laravel website and many resources available online. In addition, Laravel has a large ecosystem with various tools, packages, and even some paid services. These paid services are not essential for development, but can speed up or ease the process. &lt;/p&gt;

&lt;p&gt;The Symfony community is also large, but not as active as the Laravel community. There is extensive documentation on the Symfony website, but there are not as many resources available online as there are for Laravel. Symfony also has a large ecosystem with various tools and packages. However, because Symfony is more complex than Laravel, there are not as many paid services. Most important is the paid consulting and support offered by SensioLabs.&lt;/p&gt;

&lt;h3&gt;
  
  
  Stability
&lt;/h3&gt;

&lt;p&gt;Laravel has been released in version 9 this year. It has matured over the years, which is why it has become so successful and popular. New versions are released regularly with new features and bug fixes. However, there are only a few major versions. This means that you can upgrade to a new Laravel version without having to rewrite your entire codebase. &lt;/p&gt;

&lt;p&gt;Symfony also follows semantic versioning and new versions are released regularly. New subversions are released every six months and new major versions are released every two years. However, unlike Laravel, Symfony uses long-term support (LTS) versions. This means that a new LTS version is released every two years with bug fixes and security updates for three years. It is recommended to upgrade to the latest version every six months to reduce technical debt due to pending updates.&lt;/p&gt;

&lt;h3&gt;
  
  
  Performance
&lt;/h3&gt;

&lt;p&gt;In general, Laravel and Symfony are both quite fast and efficient. In general, Laravel is considered to be slightly faster than Symfony. However, this is not always the case and it depends on how the framework is used and set up. It's hard to give a general answer here since so many different factors play a role in performance. &lt;/p&gt;

&lt;h3&gt;
  
  
  Development time
&lt;/h3&gt;

&lt;p&gt;Laravel is known for being pretty prescriptive about how a project is set up and configured. This can lead to you spending less time developing because a lot of it is already predetermined for you. Also, the Laravel blade templating system can reduce development time by making it easier to create templates. &lt;/p&gt;

&lt;p&gt;Symfony is more flexible and gives you more freedom to configure your project the way you want. This can lead you to spend more development time because you have more decisions to make. Especially with larger projects, these decisions need to be made carefully to avoid problems later on. However, this flexibility can also be seen as an advantage, because it gives you more control over the outcome of your project.&lt;/p&gt;

&lt;h3&gt;
  
  
  Available CMS options
&lt;/h3&gt;

&lt;p&gt;There are few decent content management systems (CMS) available for Laravel, such as October CMS or &lt;strong&gt;&lt;a href="https://statamic.com/" rel="noopener noreferrer"&gt;Statamic&lt;/a&gt;&lt;/strong&gt;. The most popular is definitely Statamic, which can be used for free and offers paid pro features. &lt;strong&gt;Statamic is used by Spiegel Online&lt;/strong&gt;, one of the biggest news websites in Germany. It is also supported by a large community and is considered a safe choice for a Laravel-based project that needs to include a CMS.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Symfony's CMS&lt;/strong&gt; of choice is &lt;strong&gt;&lt;a href="https://sulu.io/" rel="noopener noreferrer"&gt;Sulu&lt;/a&gt;&lt;/strong&gt;, although there are others, we will only discuss Sulu here. Sulu has been available since 2014 and is used by companies like Trivago, 9flats or Trusted Shops. It is a good option for a Symfony-based project that needs to integrate a CMS. However, its user base is much smaller and Sulu itself is less developed. It excels in a feature known as "portals". Sulu, similar to WordPress Multisites, divides the sections of a website that can be managed separately.&lt;/p&gt;

&lt;h3&gt;
  
  
  Ecosystem
&lt;/h3&gt;

&lt;p&gt;Laravel is the clear winner when it comes to ecosystem and community. This popularity is reflected in the number of packages, templates and paid services available. Paid services include Laracasts, which offers video courses on all topics related to Laravel. Forge, a server management tool for Laravel, and Envoyer, a deployment tool. Listing them all is beyond the scope, but you can find an overview of the most popular offerings here: &lt;a href="https://laravel.com/" rel="noopener noreferrer"&gt;https://laravel.com/&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;Symfony's community and ecosystem are both significantly smaller. However, there are still many useful packages for Symfony. Some of them are EasyAdminBundle, a backend CRUD generator, and FOSUserBundle, a user management system.&lt;/p&gt;

&lt;p&gt;There's no denying that the Laravel ecosystem is impressive. With its many packages, templates, and paid services, it has everything you need to build a reliable and feature-rich app quickly and easily. If you're looking for a framework with a large community and plenty of resources, Laravel is for you.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Symfony's flexibility and control give you more freedom to configure your project according to your needs. While this requires more development time, it also allows for a more customized result. Sulu, Symfony's CMS of choice, is also a good option for projects that need to integrate a CMS. However, keep in mind that it has a smaller community and is not as developed yet.&lt;/p&gt;

&lt;p&gt;Laravel is definitely the right choice if you're looking for a framework that is fast, efficient and provides a lot of resources. It is suitable for projects that need to include a CMS while providing custom business logic. Its blade templating system makes template creation a breeze. Moreover, the Laravel ecosystem is impressive with its many packages, templates and paid services. If you're looking for a reliable and feature-rich app that you can build quickly and easily, Laravel is for you.&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>symfony</category>
      <category>opinion</category>
    </item>
    <item>
      <title>ddev: Easy Docker handling for web developers</title>
      <dc:creator>Chris Wolf</dc:creator>
      <pubDate>Sat, 25 Jun 2022 20:20:18 +0000</pubDate>
      <link>https://dev.to/laramate/ddev-easy-docker-handling-for-web-developers-2i9i</link>
      <guid>https://dev.to/laramate/ddev-easy-docker-handling-for-web-developers-2i9i</guid>
      <description>&lt;h2&gt;
  
  
  What is &lt;a href="https://github.com/drud/ddev/" rel="noopener noreferrer"&gt;ddev&lt;/a&gt;?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://ddev.readthedocs.io" rel="noopener noreferrer"&gt;ddev&lt;/a&gt; is just a helper for the usage of &lt;a href="https://www.docker.com" rel="noopener noreferrer"&gt;docker&lt;/a&gt;. It streamlines the way you interact and configure docker for web development to only a few commands and a config file.&lt;/p&gt;

&lt;h2&gt;
  
  
  tl:dr / Who is it for?
&lt;/h2&gt;

&lt;p&gt;If you're already confident with your web development process or your &lt;br&gt;
already happily using docker in one or the other way - this might not be much of a benefit for you.&lt;/p&gt;

&lt;p&gt;But, if you do not use docker at all or don't know where to start or just want to spice (speed) things up a notch, then read on.&lt;/p&gt;

&lt;p&gt;ddev lets you focus more on your code and less on dev-ops.&lt;/p&gt;

&lt;h2&gt;
  
  
  Story time: My personal way to ddev
&lt;/h2&gt;

&lt;p&gt;I used to set-up my web development projects directly on my Ubuntu-driven machine with apache's v-hosts. I had a bash-script in place which created a new directory, git repo and added a new host.&lt;/p&gt;

&lt;p&gt;But, this had some flaws and required  manual steps afterwards pretty often. In short, it got time-consuming to maintain the custom set-up script and all the changes that were made to my system... With more and more projects my time got short and I hesitated to try and learn something thats new to me  like docker.&lt;/p&gt;

&lt;p&gt;At that time, at my workplace we all used MacBooks for development while personally I am more of a Linux guy. The solution of my workplace (MAMP) was not applicable for my personal projects.&lt;br&gt;
Gladly, I changed workplaces the right time and I got introduced to a new way of how to work on web development project: ddev.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why would you use ddev and not plain docker instead?
&lt;/h2&gt;

&lt;p&gt;Using plain docker for web development would require you to either use a pre-made image or &lt;a href="https://laracasts.com/series/the-docker-tutorial" rel="noopener noreferrer"&gt;build one for your self&lt;/a&gt;. &lt;br&gt;
If you don't have special needs and only need the general stuff like php, apache and mysql, then you can save yourself some time by not re-inventing the wheel and just using ddev which comes with a pre-defined image. &lt;/p&gt;

&lt;p&gt;And it gives you even more:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ease of choice for software and versions&lt;/li&gt;
&lt;li&gt;Mailhog for catching emails&lt;/li&gt;
&lt;li&gt;Local SSL support&lt;/li&gt;
&lt;li&gt;Redis support (&lt;a href="https://ddev.readthedocs.io/en/stable/users/extend/additional-services/" rel="noopener noreferrer"&gt;optional&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Elasticsearch support (&lt;a href="https://ddev.readthedocs.io/en/stable/users/extend/additional-services/" rel="noopener noreferrer"&gt;optional&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Ngrok support &lt;a href="https://ddev.readthedocs.io/en/latest/users/topics/sharing/" rel="noopener noreferrer"&gt;optional&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why ddev and not Laravel Sail?
&lt;/h2&gt;

&lt;p&gt;Despite that I am mostly working on Laravel projects, I prefer to use ddev because it is not limited to Laravel rather than being universal for web development. With it you can run almost anything. E.g. sometimes I need to spin up a wordpress, which is just a piece of cake with ddev. Having to learn one tool instead of two or more, already validates my choice.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to get started with ddev
&lt;/h2&gt;

&lt;h5&gt;
  
  
  1. Install docker and ddev
&lt;/h5&gt;

&lt;p&gt;If you don't have docker installed, do so by following these steps.&lt;br&gt;
Afterwards, continue with the docker post-installation steps.&lt;br&gt;
Finally, head to the &lt;a href="https://ddev.readthedocs.io/en/stable/#installation" rel="noopener noreferrer"&gt;ddev installation manual&lt;/a&gt; and take all the required steps.&lt;br&gt;
Verify your installation with &lt;code&gt;ddev -v&lt;/code&gt;. &lt;/p&gt;

&lt;h5&gt;
  
  
  2. Add ddev to an (existing) project
&lt;/h5&gt;

&lt;p&gt;To run any (existing) project with ddev, just head to the projects root-directory and type &lt;code&gt;ddev config&lt;/code&gt; which starts the initialization process. It asks you for some specifics. Afterwards you can start the container by typing &lt;code&gt;ddev start&lt;/code&gt;. You should be able to reach the project in your browser.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to configure xDebug to work with ddev
&lt;/h2&gt;

&lt;p&gt;To use xDebug with ddev you have to set it up once. Each time you want to debug wit xdebug you have to start your debugging session with &lt;code&gt;ddev xdebug&lt;/code&gt;. When you're done, stop it via &lt;code&gt;ddev xdebug false&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Configure xDebug to work with ddev and PhpStorm
&lt;/h3&gt;

&lt;p&gt;To make xDebug in PhpStorm work, you have to set path-mappings in the project debug settings. For example, all my project live in the path ~/Sites/. For a project with ddev, you have to add a path mapping from ~/Sites/laravel-tinker/ to /var/www/html.&lt;br&gt;
Go to &lt;em&gt;Run &amp;gt; Edit Configurations&lt;/em&gt; and &lt;em&gt;Add a new Configuration&lt;/em&gt;. Here is a screenshot of a working configuration.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxgkiscz0j0xmxg4da8n5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxgkiscz0j0xmxg4da8n5.png" alt="ddev docker xdebug config in PhpStorm"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Configure xdebug to work with ddev and VsCode
&lt;/h3&gt;

&lt;p&gt;The setup process for VSCode is very easy. Go to the &lt;a href="https://ddev.readthedocs.io/en/latest/users/step-debugging/#visual-studio-code-vscode-debugging-setup" rel="noopener noreferrer"&gt;ddev documentation&lt;/a&gt; and download the provided &lt;a href="https://ddev.readthedocs.io/en/latest/users/snippets/launch.json" rel="noopener noreferrer"&gt;config snippet&lt;/a&gt;.&lt;br&gt;
If your're having troubles, check the ddev and xdebug version. From &lt;a href="https://github.com/drud/ddev/releases/tag/v1.19.0" rel="noopener noreferrer"&gt;ddev v1.19.0&lt;/a&gt; the default port for xdebug to listen on is 9003.&lt;/p&gt;

&lt;h2&gt;
  
  
  ddev Cheatsheet: The most important commands
&lt;/h2&gt;

&lt;p&gt;For my daily work, I found these commands as my most-used one. You can check out even more commands &lt;a href="https://ddev.readthedocs.io/en/stable/users/cli-usage/#favorite-commands" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Add ddev to a project&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

ddev config


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Start a project&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

ddev start


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Opens the main project url&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

ddev launch


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Get information about the container, like URLs and local credentials&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

ddev describe


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;When you change a PHP version or MySql version, you have to rebuild the container.&lt;br&gt;&lt;br&gt;
-O: Omit/skip database snapshot &lt;br&gt;&lt;br&gt;
-R: Remove stored project data (MySQL, logs, etc.)&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

ddev stop -O -R &amp;amp;&amp;amp; ddev start


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Starts a shell session in the container. Requires you to authenticate if your key is password protected. Useful if the container needs to access remote resources, e.g. when you're running a deployment.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

ddev auth ssh


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;(Laravel only) gives direct access to the Laravel artisan CLI&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

ddev artisan &amp;lt;command&amp;gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Start xDebug&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

ddev xdebug
ddev xdebug false


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Execute any command inside the container, example:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

ddev exec &amp;lt;command&amp;gt;
ddev exec npm run dev


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  How to define a custom command
&lt;/h2&gt;

&lt;p&gt;ddev makes it easy for you to define custom commands. For almost every project I work on, I use a custom command called "provision" for set-up instructions. In here, all steps needed to set up the project are bundled. &lt;br&gt;
Another use-case for a custom command:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;span class="c"&gt;# .ddev/commands/web/codequality&lt;/span&gt;

&lt;span class="c"&gt;#!/bin/bash&lt;/span&gt;

&lt;span class="c"&gt;## #ddev-generated&lt;/span&gt;
&lt;span class="c"&gt;## Description: Ensure code-quality&lt;/span&gt;
&lt;span class="c"&gt;## Usage: codequality&lt;/span&gt;
&lt;span class="c"&gt;## Example: "ddev codequality"&lt;/span&gt;

&lt;span class="nb"&gt;cd &lt;/span&gt;frontend
node_modules/.bin/eslint &lt;span class="nt"&gt;--ext&lt;/span&gt; .js,.vue &lt;span class="nt"&gt;--fix&lt;/span&gt; &lt;span class="nt"&gt;--ignore-path&lt;/span&gt; .gitignore &lt;span class="nt"&gt;--max-warnings&lt;/span&gt; 0 &lt;span class="nb"&gt;.&lt;/span&gt;

&lt;span class="c"&gt;## run cs-fixer&lt;/span&gt;
vendor/bin/php-cs-fixer fix

&lt;span class="c"&gt;## run tlinter&lt;/span&gt;
vendor/tightenco/tlint/bin/tlint 

&lt;span class="c"&gt;## run phpstan&lt;/span&gt;
vendor/bin/phpstan analyze &lt;span class="nt"&gt;-c&lt;/span&gt; phpstan.neon

composer outdated &lt;span class="nt"&gt;--ansi&lt;/span&gt; &lt;span class="nt"&gt;-D&lt;/span&gt; &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="nt"&gt;--strict&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h1&gt;
  
  
  Define a custom service, or how I call it: Enable two projects to communicate
&lt;/h1&gt;

&lt;p&gt;Okay, until here, all the stuff was pretty basic. Let's tackle something more interesting. Say, we have multiple projects which we're working on, e.g. an API service that we need to call from another app.&lt;br&gt;
You can just start both projects with ddev and work on them. But by default, they can't reach each other. For that, we have to use custom services and define the address where each project will be exposed to. Read about this feature &lt;a href="https://ddev.readthedocs.io/en/stable/users/extend/custom-compose-files/" rel="noopener noreferrer"&gt;in the ddev documentation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;To make a project accessible for other projects, define a yaml-file like this:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

# .ddev/docker-compose.router.yaml
version: '3.6'
services:
  web:
    external_links:
      - ddev-router:taskdoc.local.ddev.site


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;




&lt;p&gt;That's it, folks.&lt;br&gt;
Leave me a comment and maybe questions and I'll try to help :)&lt;br&gt;
Hope you find this useful!&lt;/p&gt;




&lt;h2&gt;
  
  
  Resources / ddev alternatives
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://ddev.readthedocs.io/en/stable/" rel="noopener noreferrer"&gt;ddev documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;MacOs only: &lt;a href="https://laravel.com/docs/9.x/valet" rel="noopener noreferrer"&gt;Laravel Valet&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://laravel.com/docs/9.x/sail" rel="noopener noreferrer"&gt;Laravel Sail&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://laracasts.com/series/the-docker-tutorial" rel="noopener noreferrer"&gt;Laracast tutorial on how to set up docker&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://tech.osteel.me/posts/docker-for-local-web-development-introduction-why-should-you-care" rel="noopener noreferrer"&gt;Yannick Chenot's guide to docker for web development&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://unsplash.com/@fejuz?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Title photo by Fejuz&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
  </channel>
</rss>
