The consequence you mention is that one depends more and more on tooling and services.
In Python, "import" actually imports the code.
In PHP, the "use" statement you see everywhere does not. It only works because the code has already "magically" been imported.
Usually by composer. Thats why there are tens of thousands of hits for "clear composer cache" on Google. To just point out one issue with the dependecy on a fat stack to deal with a missing import system.
You can manual include, define your own extra auto loader and use interfaces to quick swap for custom implementations.
Like I said, +15 years. Composer is 9 years old. How do you think we handle this in our own Jurassic times?
You can manual include
I don't think that will work with any code that came out in recent years. Because it all expects that its dependencies are automagically included via composer.In practice, every PHP based web application starts with Laravel or Symfony these days. So you are thrown into the composer workflow right away. And it would be a nightmare to fight it.
And then if you start needing additional functionality you can start adding packages with composer one by one. Of course it'd be stupid to build your own version of Symfony with it, but the beauty is that you can stop at any point you want if it covers your needs. This sort of thing would be much more hassle with say Java, without using any frameworks.
I find PHP packaging and dependency management to be painless compared to both Python/Ruby.
This is similar to NPM’s organisation prefix (@foo/bar).
But yeah, I’m not defending the hacky way namespaces are resolved through autoloading. I do prefer actual language support for a module system (but Ruby suffers from this problem too).
With Rails 7 and Zeitwerk, the Ruby community has landed on a very similar auto-loading system as PHP now[2] with constants translating to paths by convention.
[0]: https://github.com/php-fig/fig-standards/blob/master/accepte...
[1]: https://www.php-fig.org/psr/psr-4/
[2]: https://github.com/fxn/zeitwerk#the-idea-file-paths-match-co...
I do wish they would extend auto loading for standalone functions and constants though.