Pilihan berita dan materi segar dari dunia PHP. Dalam rilis: alpha pertama dari PHP 8.1.0, Composer 2.1, Symfony 5.3, dan rilis lainnya. Ikhtisar proposal baru untuk PHP 8.1: Aplikasi Fungsi Parsial, operator pipa, properti readonly. Ditambah sebagian alat, artikel, video, dan podcast yang berguna.
Selamat membaca!
berita
PHP 8.1.0 alfa 1
- PHP 8.1. . 25 .
20 , . :
php.watch/versions/8.1.
PHP 8.0.7, PHP 7.4.20
.
PhpStorm 2021.2
, . , .
: PHP 8.1, Extract Method, .
Composer 2.1.0
reinstall
, . .
packagist.org PHP-
Composer, Jordi Boggiano, PHP.
, packagist.org/php-statistics.
, , , symfony/console/php-stats.
PHP Russia 2021
28 . โ
, , .
: php_digest.
PHP Internals
[RFC] Partial Function Application
RFC First-class callable syntax.
โ ....
,?
โ .
:
$func = some_func(...)
โ . , .$func = some_func(1, 2, ?, 5)
โ , .$func = any_func($all, $params, ...)
โ , . , .
[RFC] Pipe Operator v2
, - .
:
array_filter(array_map('strtoupper', str_split(htmlentities("Hello World"))), fn($v) => $v != 'O');
:
$result = "Hello World" |> htmlentities(?) |> str_split(?) |> array_map(strtoupper(?), ?) |> array_filter(?, fn($v) => $v != 'O');
[RFC] Pure intersection types
, .
PHP Internals News #88 George Peter Banyard, RFC.
[RFC] Readonly properties 2.0
RFC readonly .
readonly
. .
class Test { public readonly string $prop; public function __construct(string $prop) { // Legal initialization. $this->prop = $prop; } } $test = new Test("foobar"); // Legal read. var_dump($test->prop); // string(6) "foobar" // Illegal reassignment. It does not matter that the assigned value is the same. $test->prop = "foobar"; // Error: Cannot modify readonly property Test::$prop
constructor property promotion PHP 8.0, :
class User { public function __construct( public readonly string $name ) {} } $user = new User('Roman'); echo $user->name; // Ok $user->name = 'Nikita'; // Error
[RFC] Make reflection setAccessible() no-op
,->setAccessible(true)
.
Marco ยซOcramiusยป Pivetta ,ReflectionProperty
ReflectionMethod
,setAccessible(true)
.
class Foo { private $bar = 'a'; } (new ReflectionProperty(Foo::class, 'bar'))->getValue();
- nunomaduro/php-interminal โ PHP Internals . , .
- joonlabs/php-graphql โ PHP- GraphQL. , .
- spiral/attributes โ PHP 8 PHP 7.2+ . - nikic/php-parser. SerafimArts.
- spiral/storage โ . thephpleague/flysystem API. SerafimArts.
- kalessil/production-dependencies-guar โ -
require
composer.json.
ยซยป CI.
Symfony
- Symfony 5.3 โ Symfony.
PHP Release Radar #11: Symfony 5.3, Nicolas Grekas .
Symfony Messenger: .
Symfony AWS Lambda.- Symfony #754 (7-13 2021).
Laravel
- Laravel 10 โ .
Event Sourcing Laravel โ Spatie.
.
ยซ ยป.
: Offset Cursor.
Mohamed Said, core- Laravel: Database Connections in Laravel โ Beyond the Basics, What's New in Laravel (#2).- Larastreamers.com โ .
Yii
- Yii 1.1.24 Yii 1 โ 2023 .
- yiisoft/rate-limiter โ Yii 3.
- PHP : nikic/FastRoute symfony/routing.
- PHP โ RFC Short Closures.
- ORDER BY RANDOM().
static ? โ - Beer::PHP.
PHP .
, , : .
PHP : .
/
PHP Internals News #87 โ C .
PHPTownhall Episode 81: Kitab Mazmur - Rilis podcast dengan Matthew Brown , penulis Mazmur.- Aliran intisari reguler masih dalam masa liburan, tetapi ada aliran tiba-tiba yang hebat berdasarkan PHP Intisari musim semi dari Valentin Udaltsov:
Berlangganan saluran Telegram PHP Digest .
Jika Anda menyukai intisari, tolong beri nilai plus - ini sangat memotivasi untuk terus melakukannya.
Apakah Anda menemukan kesalahan atau salah ketik? Informasikan dalam habr atau telegram pribadi .
Anda dapat mengirim tautan melalui formulir atau hanya dengan menulis kepada saya di telegram .
Mencari link di semua mencerna
โ masalah Sebelumnya: PHP-Digest # 204