Modern PHP

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • ext-openswoole

    Programmatic server for PHP with async IO, coroutines and fibers

    Laravel was recently updated to support serverless deployments, alongside the launch of Vapor[1].

    Octane[2] is also very exciting. Using Swoole[3] (or another similar driver), Laravel applications can be run entirely in-memory. Early benchmarks showed Octane increased concurrent requests from ~500/sec. to ~6,000/sec.

    [1] https://vapor.laravel.com/

    [2] https://github.com/laravel/octane

    [3] https://openswoole.com/

  • bref

    Serverless PHP on AWS Lambda

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

  • octane

    Supercharge your Laravel application's performance.

    Laravel was recently updated to support serverless deployments, alongside the launch of Vapor[1].

    Octane[2] is also very exciting. Using Swoole[3] (or another similar driver), Laravel applications can be run entirely in-memory. Early benchmarks showed Octane increased concurrent requests from ~500/sec. to ~6,000/sec.

    [1] https://vapor.laravel.com/

    [2] https://github.com/laravel/octane

    [3] https://openswoole.com/

  • React

    Event-driven, non-blocking I/O with PHP.

    We handle 50-60 million monthly page views (comments embed requests) in our commenting system using PHP/Laravel, NGINX (2 load balanced servers), Redis (for queues and caching), and MYSQL.

    All performance issues we have ever encountered were always related to the database - never had an issue with PHP or Laravel.

    However, we use Node.js for websockets. Though there are some improvements in PHP for event-driven development (like ReactPHP [1]), it was quite hard to find proper documentation and help to build a production-ready WebSocket server. So, we ended up using Node.js for that.

    The new features added to PHP in the latest versions are great. Type hinting and return types are really helpful in writing better code. I hope there will be an addition to type hint advanced data structures (ex: Arrays of Objects) in a future version.

    [1] https://reactphp.org/

  • underscore

    JavaScript's utility _ belt

    All these features have been discussed countless times in "new release" threads and such, but I don't think I ever asked public opinion on the "spaceship" operator, so I want to raise the question this time. I always ignored it as a feature that I personally don't need, but somebody else does, so ok, whatever.

    You see, I actually don't think I ever used usort in about 10 years (or how long is it since anonymous functions were introduced). Instead, in all of my projects there is an implementation of https://underscorejs.org/#sortBy

    The difference is that the callback maps the value to something that is already sortable using other native PHP functions, like an integer or a string. I find it way more intuitive than writing these function($a, $b) {/* try to remember which of [-1,0,1] it is supposed to return /} abominations. So as a solutions to remembering "which of [-1,0,1] should it be" I'd expect just natively implementing in C sane* sortBy function to replace this pre-historic PHP bullshit. But whatever, it's a matter of taste…

    …Or so I thought until now. Now that I think about it, I see [-1,0,1] callback as something really fucked up. PHP usort (and basically all PL ordering functions I know) can order only linear sequences, i.e. it returns an ordered list. Not even a lattice. Basically this means real numbers (or, more comfortable to use in a PL: strings). And with [-1,0,1] I can define whatever the fuck I want. There's nothing to stop me from implementing "paper/scissors/rock" (or even something much more convoluted) in it, and I have to idea how usort will behave then. That doesn't sound good.

    So I'd like somebody to persuade me that I personally need [-1,0,1] comparison model for some use case I apparently never encountered. The only reason I can think of why [-1,0,1] might be better is performance (or RAM, actually), but I don't accept is as a valid argument: somehow even my non-optimal sortBy PHP implementation always turns out to be enough, and if I really should worry about sorting performance, PHP probably isn't the right language for my use-case anyway.

  • ua-parser-js

    UAParser.js - Free & open-source JavaScript library to detect user's Browser, Engine, OS, CPU, and Device type/model. Runs either in browser (client-side) or node.js (server-side).

    With NPM, what's actually published is not what's in the git repo, so it's harder to inspect/review vulnerabilities or hijacking. With composer, what's in git _is_ what composer pulls (with the exception of rules in .gitattributes to exclude files etc), making it much easier to trace. One such example: https://github.com/faisalman/ua-parser-js/issues/536

    Composer packages are vendor namespaced, so hijacking an abandoned package is not possible (and it is with NPM), some examples like https://www.theregister.com/2021/08/10/github_npm_package/

  • ocaml-caqti

    Cooperative-threaded access to relational data

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

  • Laravel

    The Laravel Framework.

    For what is worth Laravel, which is PHP's most popular framework, throws an Exception:

    https://github.com/laravel/framework/blob/master/src/Illumin...

    For other frameworks, you can convert warnings into exceptions with 3 lines by implementing a custom error handler.

  • OmniPay

    A framework agnostic, multi-gateway payment processing library for PHP 5.6+

    > If their site is already Wordpress and they ask you to fix it, then your job is to fix their Wordpress site. Where is the shame and disrespect in that?

    None. I just finished up such a contract myself earlier this month. I was speaking of building new sites from scratch.

    > I agree about the spammy notifications and PHP code snippets. But sometimes code snippets can save time.

    Put code in code files, under version control. Not in the database. Not in a blob field that gets eval()ed and is editable by users. This is sane web dev 101.

    > I'd be interested to hear what good replacements there are for Wordpress+WooCommerce?

    Drupal 7 + Drupal Commerce was very nice back in the day. I don't know the current state of Commerce under Drupal 9 but it's what I'd start looking at first if someone wanted me to build them a store from the ground up. Magento is still around, though I've heard that its code is incomprehensible. And if you're not afraid to take the thin framework or frameworkless route, the Omnipay library [1] combined with standard CRUD for the products should get you pretty far.

    1: https://omnipay.thephpleague.com

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts