GitHub CLI, Laravel Zero 8 and
🐘 PHP Internals
✅ [RFC] Shorter Attribute Syntax Change
The epic story of the syntax for attributes is finally over. The #[Attribute] option has won the vote.
#[
ORM\Entity,
ORM\Table("user")
]
class User
{
#[ORM\Id, ORM\Column("integer"), ORM\GeneratedValue]
private $id;
#[ORM\Column("string", ORM\Column::UNIQUE)]
#[Assert\Email(["message" => "The email '{{ value }}' is not a valid email."])]
private $email;
}By the way, the previous syntax @@Attr did not support attribute grouping and therefore this feature was removed from PR. But since #[ ] has an end marker, support for grouping has returned.
// You can do this way
#[ORM\Entity]
#[ORM\Table("user")]
// or this way
#[
ORM\Entity,
ORM\Table("user")
]Learn more about attributes in this overview post.
🆕 [RFC] any() and all() on iterables
In this RFC Tyson Andre proposes to add two new functions to the standard lib:
any(iterable $input, ?callable $callback = null): bool— executes the callback on each element and stops at the first that returnstrue.all(...)— will only returntrueif the callback returnstruefor each element.
Here is an example of it in action:
// Before
$satisifes_predicate = false;
foreach ($item_list as $item) {
if (API::satisfiesCondition($item)) {
$satisfies_predicate = true;
break;
}
}
if (!$satisfies_predicate) {
throw new APIException("No matches found");
}
// After
if (!any($item_list, fn($item) => API::satisfiesCondition($item))) {
throw new APIException("No matches found");
}🆕 Runtime-erased generics proposal
Brent Roose, whom you might know from his posts on Laravel and PHP, came up with the idea of adding generics to PHP, but without any checks in the runtime.
Let’s say we have the following code with generics:
class Collection<T> {
public function add(T $item) { ... }
}
$c = new Collection<Product>().Static analyzers and IDEs will be able to parse it and perform analysis. However, the PHP interpreter is supposed to ignore generics and execute the code as follows:
class Collection {
public function add(mixed $item) { ... }
}
$c = new Collection().This is similar to how generics work in Hack language by default. And in Python, for example, almost all the information about types is removed in most cases and no popular interpreter validates types of arguments.
🆕 Observer API
PHP 8 will have an internal API to track when functions are entered or left. This is useful for extensions such as Xdebug, profilers, and APM solutions like New Relic, Tideways, and so on.
Find out more about the API in the 🔈 PHP Internals News podcast #68 with the authors Levi Morrison and Sammy K Powers.
🤷♂️ Misc
💻 GitHub CLI 1.0
GitHub announced the release of CLI 1.0 to interact with GitHub from the command line with issues, pull requests, releases, and more!
🐦 The Future of Phalcon
The framework was born when PHP was slow and bad. Now, that we have PHP 7 and it is fast they need to change something.

