Pilihan baru dengan tautan ke berita dan materi. Dalam edisi ini: Serat untuk asynchronous PHP, atribut asli pertama, pencocokan pendek dan proposal RFC lainnya untuk PHP 8.1, alat, banyak video, artikel dan podcast.
Selamat membaca dan Selamat Tahun Baru!
Internal PHP
- [RFC] Serat - Proposal bagus untuk PHP asinkron. Lebih detail ada di saluran Telegram . Singkatnya, ini adalah versi generator yang lebih baik yang akan memungkinkan Anda untuk menulis kode asinkron berdasarkan pustaka seperti ReactPHP / Amp jauh lebih mudah dan lebih dimengerti.
Amp v3 masih dalam pengembangan, tetapi sudah menggunakan serat, bukan janji. Berikut adalah contoh tampilan analog async / await:use Amp\Delayed; use Amp\Loop; use function Amp\async; use function Amp\await; // , int , , . $callback = function (int $id): int { return await(new Delayed(1000, $id)); // Await promise resolution. }; // $callback int, but is executed asynchronously. $result = $callback(1); // , 1 . \var_dump($result); // , . $result = await([ // , 1 . async($callback, 2), async($callback, 3), ]); \var_dump($result); // 2 .
- [RFC] #[Deprecated] Attribute β PHP 8 , . β
#[Deprecated]
. ,#[Deprecated]
, PHPE_DEPRECATED
.
, , .
, PhpStorm 2020.3. , . , - final, . - [RFC] #[NamedParameterAlias] Attribute β PHP 8.1.
, β . , API .
RFC: Named Parameters explicit opt in.
β , , .<?php use NamedParameterAlias; // Old function signature: function log($arg1) {} // New function signature introduces better name function log(#[NamedParameterAlias("arg1")] $message) {} log(arg1: "Hello World!"); log(message: "Hello World!");
Attribute::IS_REPEATABLE
. , . - [RFC] Short match β
match
PHP 8switch
.
switch(true) { ...
,if-elseif-...else
.match(true)
.
RFCmatch
match(true)
.
«».PHP 8.0: $a = 3; print match (true) { $a < 2 => 'small', $a == 3 => 'medium', default => 'large', };
: $a = 3; print match { $a < 2 => 'small', $a == 3 => 'medium', default => 'large', };
- [RFC] Configurable callback to dump results of expressions in `php -a` β Tyson Andre
php -a
.
bobthecow/psysh, PHP . . - [RFC] Add is_list(mixed $value): bool β RFC Tyson Andre.
is_list()
,true
,0, 1, 2 ... count($value)-1
.
- [PR] Add support for property initialization during cloning β - .
class Foo { public $bar; public $baz; public function withProperties($bar, $baz) { $self = clone $this; $self->bar = $bar; $self->baz = $baz; return $self; } } class Foo { public $bar; public $baz; public function withProperties($bar, $baz) { return clone $this with { bar: $bar, baz: $baz, }; } }
- Rector 0.9 β , , PHP 8.
- FriendsOfPHP/proxy-manager-lts β Ocramius/ProxyManager/ PHP >=7.1.
- fullpipe/check-them β . fullpipe1.
- multiavatar/multiavatar-php β (). 'php':

- dantleech/maestro2 β PHP- β ansible PHP . GitHub Actions. .
- matomo-org/matomo 4.0 β Google Analytics PHP. Piwik.
- jolicode/JoliNotif β PHP-. Win, macOS, Linux.
- skrtdev/NovaGram β API -.
Symfony
Laravel
- Laravel
- Blackfire Laravel Vapor
Laravel,
Freek Murzee,
Laravel Internals #3 β Laravel .
Laravel Snippet #24: Fortify, Jetstream, Breeze
Yii
- Yii 2.0.40
- yiisoft/test-support β , PSR-.
- , PHP β Matt Brown, Psalm, PHP Vimeo.
- β , β GitHub Git.
- Flysystem 2.0 .
Magento 2
- PHP 8
Xdebug 2 Xdebug 3

PHP β ? 1 (), 2 ()
: 
: PHP- []
PHP : , , []
Highload PHP Redis ( , ManyChat).
PHP 8 β . PHP .
Review kode PHP: upload-to-s3-webhook - Review kode publik oleh Mathew Napoli, penulis Bref .
Tentang mode operasi di Xdebug 3 - Video dari penulis Xdebug tentang konfigurasi kolektor debugger / profiler / cakupan.
Menghibur
- elephpant PHP8: InPHPinity lahir - Gajah baru PHP 8 tersedia untuk pre-order:

Hari ini akan ada aliran PHP Digest kedua. Semua berita dan link dari masalah + lebih detail, gambaran umum tentang apa yang dikirim, menarik tetapi tidak termasuk dalam masalah, hasil pengundian dan kontes baru dengan gajah.
Mulai pukul 20:00 Moskow, Minsk / 19:00 Kiev.
Polling: Merangkum Tahun PHP dan Bermain Gajah
Jika Anda melihat kesalahan atau ketidakakuratan, harap beri tahu kami melalui habr atau telegram pribadi .
Lebih banyak berita dan komentar di saluran Telegram PHP Digest .
Kirim tautan
Cari tautan di semua intisari
β Masalah sebelumnya: PHP Digest # 194