Fresh selection with links to news and materials. In the release: Enum in PHP 8.1, Serializable removal and $ GLOBALS limitation, plus other news from PHP Internals, PhpStorm 2020.3, Symfony UX, a portion of useful tools, a video, and the first PHP Digest Stream.
Enjoy reading!
News and releases
- PhpStorm 2020.3 : PHP 8, Attributes, PHPStan and Psalm, Xdebug 3, Tailwind CSS and Co-development.
- JetBrains Qodana EAP β JetBrains PhpStorm CI.
- Slack $27 β , PHP, Hack.
- WordPress 5.6 β C - PHP 8.
- PHP β 2020.2 β , Composer packagist.org.
β’ PHP 7.4: 42.61% (+22.55)
β’ PHP 7.3: 27.05% (-3.00)
β’ PHP 7.2: 15.28% (-12.21)
β’ PHP 7.1: 7.45% (-4.1)
β’ PHP 5.6: 2.71% (-2.28)
β’ PHP 7.0: 2.70% (-1.30)
PHP Internals
- [RFC] Deprecate passing null to non-nullable arguments of internal functions β PHP
null
,nullable
. ,str_contains("", null)
, , null .
str_contains("", null); // > No errors function _str_contains ( string $haystack , string $needle ) : bool { return true; } _str_contains("", null); // > Fatal error: Uncaught TypeError: Argument 2 passed to _str_contains() must be of the type string, null given
8.1 deprecation notice.
declare(strict_types=1);
. - [RFC] Restrict $GLOBALS usage β ,
$GLOBALS
,INDIRECT
PHP. PHP.
RFC$GLOBALS
.
, , isset unset:
$GLOBALS['x'] = 1; echo $GLOBALS['x'] isset($GLOBALS['x']); unset($GLOBALS['x']);
.
$GLOBALS :
$GLOBALS = []; $GLOBALS =& $x; $x =& $GLOBALS; unset($GLOBALS);
,$GLOBALS
:
asort($GLOBALS); // > Compile-time error
: : Β« PHPΒ».
- [RFC] Phasing out Serializable β 7.4 :
Serialiazable
__serialize()
__unserialize()
.
Serializable
. PHP 8.1 deprecation notice, PHP 9.0 β compile-time error. - [RFC] Enumerations β Ilija Tovilo Larry Garfield enum RFC, Swift, Rust, Kotlin.
Enum , β . , , Β« Enums XΒ» Β« , Β». .
enum
case
:
enum Suit { case Hearts; case Diamonds; case Clubs; case Spades; }
:
$val = Suit::Diamonds; function pick_a_card(Suit $suit) { ... } pick_a_card($val); // OK pick_a_card(Suit::Clubs); // OK pick_a_card('Spades'); // TypeError
Enum -:
$a = Suit::Spades; $b = Suit::Spades; $a === $b; // true $a instanceof Suit; // true $a instanceof Suit::Spades; // true
Enum. , :
enum Suit: string { case Hearts = 'H'; case Diamonds = 'D'; case Clubs = 'C'; case Spades = 'S'; } echo "I hope I draw a " . Suit::Spades; // prints "I hope I draw a S".
Enum , . :
enum UserStatus: string { case Pending = 'pending'; case Active = 'active'; case Suspended = 'suspended'; case CanceledByUser = 'canceled'; public function label(): string { return match($this) { UserStatus::Pending => 'Pending', UserStatus::Active => 'Active', UserStatus::Suspended => 'Suspended', UserStatus::CanceledByUser => 'Canceled by user', }; } } foreach (UserStatus::cases() as $key => $val) { printf('<option value="%s">%s</option>\n', $key, $val->label()); }
:
- case?
- ?
function stuff(Suit::Heart|Suit:Diamond $card) { ... }
- Enum?
- <
enum
? ,Enum
. :enum class UserStatus {...}
- [RFC] Algebraic Data Types β Enum PHP. ** tagged unions pattern matching.
- [RFC] Direct execution opcode file without php source code file β . , -
.pyc / .pyo
.
PHP . ,<?phpo%php_version_id%
.
include()
,include_once()
,require()
,require_once()
. - [RFC] Wall-Clock Time Based Execution Timeout β PHP . sleep() . , ini-
max_execution_time
.
RFCmax_execution_wall_time
, .
- itsgoingd/clockwork v5.0 β Chrome, dev tools PHP-. PHP.
- nicofff/LazyIter β . Rust. .
- veewee/composer-run-parallel β Β«scriptsΒ» composer.json.
- clue/phar-composer β composer.json phar .
- clue/commander β .
- quasilyte/phpgrep 1.0 β PHP- β grep, «» PHP.
Symfony
- Symfony UX β Symfony - npm, Webpack Encore Stimulus js. PHP+JS , Composer: symfony/ux.
- Symfony #728 (7-13 2020)
- Action-Domain-Responder Symfony
- Symfony
- Symfony Workshop 2020 β Symfony.
Laravel
- Laravel Sail β CLI- Laravel- Docker.
- tailflow/laravel-orion 1.0 β REST API Eloquent- .
- asantibanez/laravel-eloquent-state-machines β ( ) Eloquent . , .
- lukeraymonddowning/honey β - .
- October CMS Laravel 6?
- Laravel Internals #2 β Laravel.
- Laravel at Scale: Framework, Community & Ecosystem β .
- Laravelβ (6β13 2020)
Yii
- Yii 1.1.23 β C PHP 8.
- yiisoft/cookies β Yii 3. - PSR-7.
- SOLID . - ActiveQuery Yii2
Async PHP
- clue/reactphp-zenity β Zenity GUI PHP. Ubuntu.
- PHP- β Wikipedia, : wikimedia/php-excimer β wikimedia/arc-lamp β -.
We ingest about 3 million samples daily from a cluster of 150 Apache servers in any given data centre, using a 60s sample interval. These are all received by a single Redis instance.
- AWS Lambda PHP, Docker
- Travis CI GitHub Actions β , Travis CI .
- php.watch: JIT PHP 8
- Faker 2.0 β Faker . Faker.
- PHP Zend
- : gRPC- PHP
- C++, JS, Python, Python + numba, PHP7, PHP8, Golang β β
- Telegram , 1
- : ,
- MySQL Slack Vitess
- Β«PHP Β» Matthias Noback . β lex111, PHP.
/
- PHP 6.5
- Intro to PHP | Learn PHP The Right Way - Another video course for beginners.
- OOP video course in PHP for beginners
- Writing a Blog in PHP - And More For Newbies.
- What's New in PHP 8.0 - A detailed breakdown of what's new in PHP.
Entertaining
- Symfony 15th Anniversary Elephant Now Available
Today I will stream the PHP digest for the first time. All news and links from the issue + more details, an overview of what was sent, interesting but not included in the issue, and a contest with elephants.
Beginning at 20:00 Moscow, Minsk / 19:00 Kiev.
If you notice an error or inaccuracy - please let us know in a personal habr or telegram .
More news and comments on the PHP Digest Telegram channel .
Send link
Search links in all digests
β Previous issue: PHP-Digest β 193