Automated Laravel Upgrades

0
Language

Level

Beginner

Access

Paid

Certificate

Paid

Hi! I’m Jason McCreary. I’m the founder of Laravel Shift, a popular service that provides automatic upgrades for your Laravel applications. In this CreatorSeries, using all of the knowledge I’ve acquired over the years of building and maintaining Shift, I’ll show you how to automate many of your every-day development tasks.

Add your review

PHPLint and Validation

Before we can get started, we first need to validate our code using phplint. Once we understand the basics, we’ll then write a short PHP script that runs phplint across all relevant PHP files within our current project.

Error Message Parsing

In this episode, we’ll take ten minutes or so to optimize the output of our linter script. We’ll leverage regular expressions to only expose the error details that we most care about.

Consistent Formatting With Laravel Pint

The next thing that will help us with our automation efforts is knowing that the code conforms to a consistent style. While there are a variety of tools we can reach for us, let’s go with Laravel Pint.

Automate the Automation

Now that we have the scripts and tools to automate certain portions of our development workflow, it would be nice to next… automate the automation.

Detect Accidental Debugging Statements

Now that we’ve successfully automated the automation, it’s time to build some custom scripts. Why don’t we start with a script that detects any lingering var_dump, print_r, or other similar debugging statements.

How to Parse PHP

As illustrated in the previous episode, we need a way to overcome some of the limitations of searching via regular expressions. In this episode, we’ll learn how to parse and inspect the actual PHP code by leveraging the excellent PHP-Parser project.

Automatically Remove Debugging Statements

Now that our debug script is finding the calls that we actually care about, we can take things one step further. Let’s write a script that automatically removes these lingering statements from the code!

Streamlining Script Execution With Laravel Zero

It’s currently a bit cumbersome to run our debug scripts. To remedy this, let’s pull in Laravel Zero. We’ll discuss its installation, and then transition our code to a more object-oriented structure.

Task Discovery

In this lesson, I’ll demonstrate how to implement auto-discoverability for our tasks. This way, anyone can contribute and include their own tasks as part of our command runner.

Automate Eloquent Method Ordering

For our final example of automation, let’s work on something a bit more complex. We’ll write a script that ensures that the methods of an Eloquent model are displayed in the correct order.

Automate Eloquent Method Ordering: Part 2

Now that we have all the pieces of our model class, next we can move on to sorting them in the appropriate order. We’ll tackle constant, property, and method ordering.

Discovering Relationships in PHP Models

In this episode, we explore how to identify relationship methods in PHP models using regular expressions and update our finder to recognize these methods. We can then sort the methods by type or name depending on our preference.

Organizing Model Classes in Laravel

In this final episode, I’ll demonstrate how to organize methods, properties, and constants within a model class in Laravel. We’ll also review some valuable tips on how to refactor code and build automation using the Abstract Syntax Tree.

User Reviews

0.0 out of 5
0
0
0
0
0
Write a review

There are no reviews yet.

Be the first to review “Automated Laravel Upgrades”

×

    Your Email (required)

    Report this page
    Automated Laravel Upgrades
    Automated Laravel Upgrades
    LiveTalent.org
    Logo
    LiveTalent.org
    Privacy Overview

    This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.