#484 Minor PHP Guidelines update (for PSR-4)
Closed: Fixed None Opened 4 years ago by remi.

Current Guidelines have explaination for PSR-0

{{{
A PSR-0 [1] compliant library would put its PHP files in /usr/share/php/<vendor name="">
}}}

PSR-0 use a full tree which match class namespace, which is perfect for downstream.

But a lot of library start to switch to PSR-4. In this new standard, some top directories of the PSR-0 tree can be dropped from the sources tree. (A PSR-4 autoloader have to be aware of this dropped prefix).

PSR-4 have no sense for downstream distribution.

Proposal: restore a PSR-0 compliant tree to avoid any name conflict. Such an installation can be used from a PSR-0 or PSR-4 autoloader:

  • PSR-0 autoloader config: Foo\Bar are in /usr/share/php
  • PSR-4 autoloader config: Foo\Bar are in /usr/share/php/Foo/Bar

In both case Foo\Bar\Pop class is /usr/share/php/Foo/Bar/Pop.php

Proposed changes to PHP Guidelines

Just add

{{{
A PSR-4 [2] compliant library would put its PHP files
in /usr/share/php/<vendor name=""> in a PSR-0 compliant tree.
}}}

With link to https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md

This change is mostly only to avoid ambiguity, some PHP packaged libraries already follow this (sometime, simply because upstream have switch from PSR-0 to PSR-4 in their sources repository)


We discussed this at this weeks meeting (http://meetbot.fedoraproject.org/fedora-meeting-1/2015-01-08/fpc.2015-01-08-17.01.txt), summary is:

  • 484 Minor PHP Guidelines update (for PSR-4) (geppetto, 17:05:52)

  • LINK: https://fedorahosted.org/fpc/ticket/484 (geppetto, 17:05:52)
  • ACTION: Minor PHP Guidelines update, for PSR-4 (+1:6, 0:1, -1:0)
    (geppetto, 17:12:35)

I wrote this up during the meeting.

Announcement text:

Added information to the PHP guidelines on dealing with PSR-4 libraries. http://fedoraproject.org/wiki/Packaging:PHP

Metadata Update from @tibbs:
- Issue assigned to tibbs

2 years ago

Login to comment on this ticket.

Metadata