Update of "FeatureComparison"
Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Artifact ID: | 9eb2a4de0db7232aefc06b97ac615298b8c9214b |
---|---|
Page Name: | FeatureComparison |
Date: | 2014-09-02 20:33:08 |
Original User: | mario |
Mimetype: | text/x-markdown |
Parent: | 979cde52ced37195ce4daba5685d8edf82a7af1f (diff) |
Next | ad6ecaf1bb210163846d1be6f9d120873f805bd8 |
Let me just preface this with: inconclusive conventions are better than no standards at all. And there's probably nothing newsworthy here.
Due to the ellipses in the PSR-x documents it's however helpful to detail some technical deviations and oversights.
Feature | PHP | PSR-0 | PSR-4 | shared |
---|---|---|---|---|
Class autoloading | โ | โ | โ | โ |
Zero configuration | โ | โโ | โโ | โ |
Multiple class declarations per script | โ | โโยน | โโยน | โ |
Namespace support | โ | โ | โ | โ |
Multiple namespaces per file | โ | โโ | โโ | โ |
Syntax verification | โ | โโ | โโ | โ |
Specific underscore treatment | โ | โโ | โโ | โ |
Case-insensitive class identifiers ยฒ | โ | โโ | โโยฒ | โ |
Function names | โ | โฟ/โ | โฟ/โ | โ |
Case-variant constants | โ | โฟ/โ | โโฟ/โ | โ |
Phar package support | โ | โโยณ | โโ | โ |
Versioned bundles โด | โ | โโ | โโ | โ |
- Impractical, but symlinking dependency-conjoined class modules might be a feasible workaround.
- Not just accidentally on some plattforms or filesystems.
- While prohibited, most PSR-0 autoloaders work with handicrafted phar:// paths in their namespace registry.
- Not a discreet PHP or Phar feature, and resolving dependencies is certainly still best left with composer, not done at runtime.
Origin of PSR-0/4
PSR-4 inherits the PSR-0 design as intended for and from PHP framework maintainers. Retaining the traditional class directory structures was the protogenic goal then. PSR-4 constitutively just removed the PEAR-style name splitting.
Which is where the plattform ambiguity due to absent identifier-to-file case normalization issues from. Holding on to the handed down file structuring schemes is also why namespaces were interpreted as PHP 5.3s only significant addition, but Phar support disregarded.
Composer relationship
Composer is married to PSR-0/4. Technically it's not a dependency, as highlighted by Composers very own classmap generator. (Which however infers the shallow semantics of singly-namespaced-class-per-file, invalid identifier mapping, zilch phar support).
Divorcing your way out of an abusive marriage is no small feat. Yet composer may keep the kids. When extracting packages, it's neither out of the picture to apply some common sense and strtolower
, or repackage coherent bundles into phars. Thus development sources still may follow any of the framework guidelines, yet be used unambiguously cross-plattform.