Laravel 7.6 released!!! PHP developers must see


The laravel team released v7.6.0, which includes 13 new features and the latest fixes and changes to the 7. X branch:

Add “until” method to collection

Jason McCreary contributedCollection::until()  Method, which can iterate through the collection until the element meets the condition, and then return the element:

// Before
[$before, $after] = $primes->partition(function ($item) {
    return $item < 11;

// Using until
$passed = $primes->until(11)->dump();

This method uses closures or values to compare with sets.

String Empty Methods

Mark van den broek provides some convenient methods for stringable and htmlstring. first,HtmlString::isEmpty()  Method makes it more convenient for us to detect empty instances

$string = new \Illuminate\Support\HtmlString(''); 

// Previously
if (empty($string->toHtml()))

// Using isEmpty
if ($string->isEmpty())

Second, mark contributedisNotEmpty()  method

use Illuminate\Support\Stringable;

(new Stringable())->isNotEmpty(); // false
(new Stringable('Hello World'))->isNotEmpty(); // true

Trim method of stringable class

Ryan Chandler contributed to the stringable classltrimandrtrimMethod to trim the characters at the beginning and end of a string:

use Illuminate\Support\Stringable;

echo (new Stringable(' Hello World'))->ltrim(); // 'Hello World'
echo (new Stringable('Hello World '))->rtrim(); // 'Hello World'
echo (new Stringable('/example/'))->rtrim('/'); // '/example'

Specific routing ignore Middleware

@Dsazup provides the function of skipping middleware when defining route


HTTP client: get JSON response as object

Adrian N ü Bernberger contributedobject()Method to return a JSON response body in the form of an object instead of an associative array

// Array access

// Using json()
$response = Http::get('some-api.wip')->json();

// New option
$response = Http::get('some-api.wip')->object();

Component alias

Dries vints contributed   To set an alias for a component:

I come across a scenario where I need to conditionally render the content of a component based on its alias. For example, when you have an SVG component and useAs an alias for this component, it is as follows:

Blade::component(Svg::class, 'heroicon-o-bell');

It’s better than thatThis way is more concise. Adding aliases to the component class will add many new uses and possibilities for blade components

Append Attributes Across an Eloquent Collection

Niels faurskov contributed oneeloquentSet method   append()  , He can attach specific attributes to the collection:

// Before Laravel 7.6
$collection->each(function($model) {

// Append method

Retry after method is supported

@Ryan Dadeng has contributed a method level support to the development of queue listenersretryAfterSupplement to apply to more advanced use cases:

// listener implementation

public function retryAfter()
    //Custom retryafter logic

Support the new version of composer installed.json format

Jakub Arbet   support   The snapshot function of the new version of composer 2 is not stable, but it is still backward compatible with the old version of composer

In the latest snapshot version of composer, the format of vendor / composer / installed.json has been changed, which destroys the function of automatic package discovery. This PR solves this problem by backward compatibility with earlier versions of composer.

UUID supports changes

Mathieu tudisco supportsuuidColumn usagechange()Method, leading to the following errors:

Unknown column type “uuid” requested.

Release notes

You can see the complete list of new features and updates on GitHub and 7.5.0 and 7.6.0] below(…)   The difference between them. The full release notes for laravel 7. X can be found in the latest V7 changelog:


newly added

  • newly addedCollection::until()Methods ()
  • newly addedHtmlString::isEmpty()Methods (,  # 32300)
  • newly addedIlluminate\Support\Stringable::isNotEmpty()Methods ()
  • Illuminate\Support\StringableClass newltrim()andrtrim()Methods ()
  • Add the function of ignoring middleware (# 32347,   412261c)
  • newly addedIlluminate\Http\Client\Response::object()Methods (# 32341)
  • Support setting component alias (ා 32346)
  • newly addedIlluminate\Database\Eloquent\Collection::append()Method (# 32324)
  • “Between” statement is added to the pivot column of belongstomany (# 32364)
  • Queue monitoring supportretryAfter()Methods (# 32370)
  • New format support for the new version of composer installed.json (# 32310)
  • Add database migration fileuuidChange support (# 32316)
  • Allow saving resources to PostgreSQL byte (# 32319)


  • Fix phpredis*scanMethods (# 32336)
  • repairIlluminate\Auth\Notifications\ResetPassword::toMail()(#32345)
  • stayIlluminate\Translation\Translator::__construct()Call setlocale   ( 1c6a504)
  • Use mapping to prevent unnecessary array accessIlluminate\Http\Resources\Json\PaginatedResourceResponse::toResponse()(#32296)
  • Prevent timestamp update when pivot is not modified (# 32311)
  • Repair current_ Time stamp inIlluminate\Database\Schema\Grammars\MySqlGrammarPrecision bug in


  • HtmlStringAdd the default value to the constructor of (# 32290)
  • useBindingResolutionExceptionLabel container parsing problem (#32349)
  • Illuminate\Validation\Concerns\ValidatesAttributes.php ::validateUrl()Use symfony / validator 5.0.7 to match (# 32315)


  • DisuseelixirFunction (# 32366)

More learning content can be accessedAs long as you can read it, your salary will go up a step

The above contents hope to help youA lot of PHPer always encounter some problems and bottlenecks when they are upgrading. They write too much business code and have no sense of direction. They don’t know where to start to improve. For this, I have sorted out some materials, including but not limited to:Distributed architecture, high scalability, high performance, high concurrency, server performance tuning, tp6, laravel, yii2, redis, spool, swoft, Kafka, MySQL optimization, shell script, docker, microservice, nginxAnd so on many knowledge points advanced dry goods need can be free to share with you, need can click the link to getAdvanced PHP monthly salary 30K > > > architect growth path [free access to videos and interview documents]

Recommended Today

Large scale distributed storage system: Principle Analysis and architecture practice.pdf

Focus on “Java back end technology stack” Reply to “interview” for full interview information Distributed storage system, which stores data in multiple independent devices. Traditional network storage system uses centralized storage server to store all data. Storage server becomes the bottleneck of system performance and the focus of reliability and security, which can not meet […]