▲ 13 r/PHP

Enforce Runtime Generics on Third-Party Collections Libraries (Doctrine, Ramsey, Laravel Collections) with TypePHP

More than a week ago, I posted an introduction to TypePHP. Thanks to Michael Telgmann, a core maintainer at Shopware, TypePHP has been tested against Shopware’s massive codebase. So far, it has identified many DocBlock lies in the codebase PR, while also uncovering many edge cases on TypePHP’s end.

Today, I’d like to share a article guide on how to make existing third-party collection libraries, such as Doctrine Collections or Ramsey Collections, capable of enforcing reified collections without modifying their source code.

reified generics proof: Symfony Integration

typephp-php.github.io
u/rc0604 — 2 days ago
▲ 15 r/PHP

TypePHP: Transparent runtime type enforcement for PHPDoc generics, type arrays, and scalar refinements in pure PHP

Hello Everyone I just written a pure PHP library for actually checking docblock types at runtime similar to Phyton Beartype but without using any custom syntax like decorators or attributes.

With this library you can finally type check docblock generics, type-arrays, and many more with just plain docblocks at runtime. I know I cant post images to this sub so here's an image proof upload in imgur:

https://imgur.com/a/4IBefOQ

Correct me if I'm wrong but there's no PHP library in userland that able to transparently check docblock types at runtime so I can proudly say this library is the first. Any questions and feedbacks are welcomed.

Link to the repo: https://github.com/typephp-php/typephp
Link to docs site: https://typephp-php.github.io/typephp/

I know there’s an upcoming proposal for reified generics, but I doubt it will provide fully featured generics or type arrays if it get accepted by majority of internals.

PS: I know there’s another upcoming project called “TypePHP” from the Swoole project, but they haven’t provided a license or made any copyright claim on the name. So, I think I can use this name without any problems, right? If not, I may change the project name in the future.

u/rc0604 — 12 days ago

No way!! Just got free 6 months free claude max subscription from my open source project

https://preview.redd.it/85aidrkza4eh1.png?width=1156&format=png&auto=webp&s=bb83a120e1bbd252c67c96c46b82bc655496174e

Just wanted to share some good news.. My HiblaPHP project was accepted into Anthropic's Claude for Open Source program, which includes 6 months of Claude Max for free.

I honestly applied just to see if the project would qualify, so I was pleasantly surprised when it got accepted. It's really encouraging to see more support for open-source maintainers.

If you're curious, check out the project here: https://github.com/hiblaphp/hibla

I love to see more Open Source projects flourish in our country..

reddit.com
u/rc0604 — 1 month ago
▲ 149 r/PHP

The PHP Polling API RFC is currently passing 19-0 and it might be the most impactful thing to happen to PHP in years and nobody is talking about it

PHP is about to reach its fullest potential for scaling natively and almost nobody noticed.

The Polling API RFC is currently in its voting phase with 19-0 and zero opposition as of the time of writing this post, while the community was busy debating generics. It brings native epoll and kqueue to PHP 8.6 core, which means async libraries like AMPHP and ReactPHP finally get a proper high-performance foundation without relying on PECL extensions.

I wrote a deep dive on why I think this is the most impactful thing to happen to PHP since types were introduced in PHP 7. I'm the author of HiblaPHP, and I will be rewriting its core Event Loop the day this RFC merges into PHP core.

link to the rfc: https://wiki.php.net/rfc/poll_api

medium.com
u/rc0604 — 3 months ago
▲ 75 r/PHP

Polling API RFC is now in voting phase

This RFC is now in the voting phase. Lowkey, it could have a massive impact on PHP, especially by bringing more modern backend stream handling. It would also replace stream_select() and make async PHP libraries far more viable without relying on extensions like ext-uv to bypass file descriptor limitations and O(N) performance.

wiki.php.net
u/rc0604 — 3 months ago
▲ 6 r/PHP

Building High Performance Self Healing Process Pool with Hibla Parallel

Hello everyone, I just wanted to share a past article I wrote about this topic. I’d love to hear your thoughts, feedback, or any questions you may have.

medium.com
u/rc0604 — 3 months ago
▲ 19 r/PinoyProgrammer+1 crossposts

Hibla Postgres: A pure non blocking PostgreSQL client for PHP is now available in beta release.

Hello everyone! I'm excited to announce that hiblaphp/postgres, built on top of ext-pgsql, is now available in beta, fully tested and can now be installed via Composer.

With this release, the core database drivers for Hibla are now complete alongside the Hibla MySQL client. My next goal is to build an asynchronous query builder with support for migrations and pagination before moving on to developing an HTTP server.

Some of the key features currently included are:

  • Fully non-blocking query execution
  • Name parameter and Positional parameter binding support like "?" and ":name" for prepared statements
  • Server-side query cancellation
  • Pub/Sub event-driven notifications with auto-reconnect support
  • Streaming support
  • Connection pooling

I'd really appreciate any feedback, whether it's feature suggestions, questions, or even harsh criticism. Every bit of feedback helps improve the project.

github.com
u/rc0604 — 3 months ago
▲ 0 r/PHP

What are your thoughts on this?

What if, as a compromise, a generics implementation in PHP supported optional runtime enforcement through a php.ini configuration, similar to how assert() works with zend.assertions? This would provide the best of both worlds: runtime generics during development for stronger validation and debugging, while still allowing static analysis tools like PHPStan and Psalm to handle compile-time type analysis and developer tooling. In production, the runtime checks could be completely erased for maximum performance.

reddit.com
u/rc0604 — 3 months ago

I got my first sponsor in my open source project.. Medyo nakakatawa nga lang

Hello I'm the Author of [HiblaPHP](https://github.com/hiblaphp), I just wanted to share that after weeks that I publicly announce my open source project in public social media's, nakaakit na rin ng sponsor. I'm so thankful to anyone here who believe and starred my project at sa bagong company sponsor. I hope this foster Filipino spirit on OSS. If anyone interested in contributing to the project feel free to submit issues and pr..

Ps. Medyo nakakatawa ngalang pangalan ng company sponsor na nakuha ko at parang minalas naman hahaha..

u/rc0604 — 3 months ago