Why does PHP not have object-oriented strings and arrays? Will it be added in a future version

This page summarizes the projects mentioned and recommended in the original post on /r/PHP

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

    Extension that adds support for method calls on primitive types in PHP

  • Nikita Popov tried to solve the problem with this extension, but it never got wide support. The problem is that without users asking for this feature, Jetbrains and psalm/phpstan will not integrate it. But w/o their support, users cannot not even try the extension as everything will be shown as error.

  • Stringy

    A PHP string manipulation library with multibyte support

  • A number of libraries likely already exist to do these kinds of things, for example with strings, Laravel has a string class which has an of() method, Statamic has a modify/modifier class, there are probably other projects or libraries, but I know that Statamic does leverage https://github.com/danielstjules/Stringy via this fork https://github.com/statamic/Stringy

  • 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.

    WorkOS logo
  • Stringy

    A PHP string manipulation library with multibyte support, now with PHP 7.3 support (by statamic)

  • A number of libraries likely already exist to do these kinds of things, for example with strings, Laravel has a string class which has an of() method, Statamic has a modify/modifier class, there are probably other projects or libraries, but I know that Statamic does leverage https://github.com/danielstjules/Stringy via this fork https://github.com/statamic/Stringy

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