Nova seleção com links para notícias e materiais. Nesta edição: Fibras para PHP assíncrono, primeiros atributos nativos, correspondência curta e outras propostas RFC para PHP 8.1, ferramentas, muitos vídeos, artigos e podcasts.
Boa leitura e feliz ano novo!
PHP Internals
- [RFC] Fibras - Uma ótima proposta para PHP assíncrono. Mais detalhes no canal Telegram . Resumindo, esta é uma versão aprimorada de geradores que permitirá a você escrever código assíncrono baseado em bibliotecas como ReactPHP / Amp de forma muito mais fácil e compreensível.
O Amp v3 ainda está em desenvolvimento, mas já usa fibras em vez de promessas. Aqui está um exemplo de como o análogo async / await se parece: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 .
Revisão do código PHP: upload-to-s3-webhook - Revisão do código público por Mathew Napoli, autor de Bref .
Sobre os modos de operação no Xdebug 3 - Vídeo do autor do Xdebug sobre a configuração do depurador / profiler / coletor de cobertura.
Divertido
- elephpant PHP8: Nasce o InPHPinity - O novo elefante PHP 8 está disponível para pré-encomenda:

Hoje haverá o segundo stream do PHP Digest. Todas as notícias e links da edição + mais detalhes, uma visão geral do que foi enviado, interessante mas não incluída na edição, os resultados do sorteio e um novo concurso com elefantes.
Começando às 20:00 Moscou, Minsk / 19:00 Kiev.
Enquete: Resumindo o Ano PHP e Jogando o Elefante
Se você notar um erro ou imprecisão, informe-nos por meio de um habr ou telegrama pessoal .
Mais notícias e comentários no canal PHP Digest Telegram .
Enviar link
Links de busca em todos os resumos
← Número anterior: PHP Digest # 194