Latest in branch 5.8
5.8.35
Released 09 Sep 2019
(6 years ago)
SoftwareLaravel
Version5.8
Status
End of life
Supported
PHP versions
PHP ≥ 7.1.3
Initial release5.8.0
26 Feb 2019
(7 years ago)
Latest release5.8.35
09 Sep 2019
(6 years ago)
End of bug fixes26 Aug 2019
(Ended 6 years ago)
End of security fixes26 Feb 2020
(Ended 6 years ago)
Release noteshttps://github.com/laravel/laravel/releases/tag/v5.8.35
Source codehttps://github.com/laravel/laravel/tree/v5.8.35
Documentationhttps://laravel.com/docs
Downloadhttps://laravel.com/docs/master/installation
Laravel 5.8 ReleasesView full list

What Is New in Laravel 5.8

Laravel 5.8 brings a set of foundational updates, from a new Eloquent relationship to a shift in underlying dependencies. This release focuses on refining the developer experience with more robust tools.

Category Key Changes
New Features Eloquent HasOneThrough relationship, Auto-Discovery for Traits, Carbon 2.0, PHPDoc generation
Improvements Cache TTL in seconds, Artisan::call arguments, Artisan serve improvements, Multiple Broadcast Drivers
Deprecations & Changes Array and String Helpers deprecated, PHPUnit 8.0, Dotenv 3.0, Predis 1.1, Email Verification

What new Eloquent relationships were introduced?

The standout addition is the Eloquent HasOneThrough relationship. This allows you to link a model through a single intermediate model, which is useful for scenarios where a direct relationship isn't possible.

In practice, you might use this to access a supplier's history through a user account. The syntax is clean and follows the established Laravel relationship patterns, making it intuitive to implement.

class Supplier extends Model
{
    public function userHistory()
    {
        return $this->hasOneThrough(History::class, User::class);
    }
}

How has package auto-discovery been improved?

Auto-discovery now extends to traits, not just service providers and facades. This means packages can automatically register their traits without requiring any manual setup in your application.

This matters because it removes another small bit of friction when installing packages. You get the functionality you need without having to remember to add another line to a config file.

What are the key dependency updates?

Laravel 5.8 bumps several core dependencies. It now requires PHPUnit 8.0 for testing, uses vlucas/phpdotenv ^3.0, and upgrades to Predis 1.1 for Redis operations.

The most noticeable change for developers is the Carbon 2.0 integration. This update brings a more consistent and improved date handling API, which is crucial for any application dealing with timezones and date manipulation.

How is caching handled differently?

The cache()->remember() method and related functions now accept the Time-To-Live (TTL) in seconds instead of minutes. This provides much finer control over how long items are stored in the cache.

This is a breaking change. If your code passes integers to these methods, you'll need to update the values from minutes to seconds. Using a DateTimeInterface instance remains unchanged.

What helpers were deprecated?

The global array_ and str_ helper functions have been deprecated. You should transition to using the methods available on the Arr and Str facades instead.

For example, replace str_slug() with Str::slug(). This change pushes the framework towards a more object-oriented style and avoids global namespace pollution.

FAQ

Is the cache TTL change in Laravel 5.8 a breaking change?
Yes. If your application code passes an integer to cache methods like remember, it is now interpreted as seconds, not minutes. You must review and update all integer-based TTL values.

How do I generate PHPDocs for my Eloquent models in 5.8?
Use the new php artisan ide-helper:generate command. This will create a file that provides accurate autocompletion and type hints for your model properties and relationships in supported IDEs.

What should I use instead of the deprecated global string and array helpers?
Use the corresponding methods on the Illuminate\Support\Str and Illuminate\Support\Arr classes. For example, use Str::slug() instead of str_slug().

Does Laravel 5.8 require a new version of PHP?
It requires PHP >= 7.1.3. The upgrade to dependencies like PHPUnit 8.0 also means your development and testing environment needs to be compatible with these new versions.

How do I use the new HasOneThrough relationship?
Define it in your Eloquent model like any other relationship. The method should return the result of the $this->hasOneThrough() method, specifying the final model and the intermediate model as arguments.

Releases In Branch 5.8

VersionRelease date
5.8.3509 Sep 2019
(6 years ago)
5.8.1714 May 2019
(7 years ago)
5.8.1607 May 2019
(7 years ago)
5.8.328 Feb 2019
(7 years ago)
5.8.026 Feb 2019
(7 years ago)