Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use PSR-4 for autoloading #959

Merged
merged 1 commit into from
Jun 27, 2017
Merged

Use PSR-4 for autoloading #959

merged 1 commit into from
Jun 27, 2017

Conversation

jtojnar
Copy link
Member

@jtojnar jtojnar commented Jun 24, 2017

When we introduced the use of Composer classmaps for autoloading in df6f5d0, we lost the ability to define custom spouts without dumping the autoloader. PSR-4 would fix this issue but at the time I came to conclusion we would have to change selfoss file structure to support it.

Since that assumption seems to be false, we are switching to PSR-4, thus having the cake and eating it too. The only caveat is the need for more strict file naming conventions.

Closes: #958

Upgrading

If you use any custom classes like spouts, make sure they follow PSR-4, namely the namespace should match the file path (even in letter case).

For example, if you have custom spout class named PrivateSpout in spouts\private namespace, it will have to be located in spouts/private/PrivateSpout.php.

This also means each file can only contain a single class.

Upgrading (developers)

Once you checked for compliance, run composer install as described in the development section of README to switch to PSR-4 autoloader.

When we introduced the use of Composer classmaps for autoloading in
df6f5d0, we lost the ability to define
custom spouts without dumping the autoloader. PSR-4 would fix this issue
but at the time I came to conclusion we would have to change selfoss
file structure to support it.

Since that assumption seems to be false, we are switching to PSR-4, thus
having the cake and eating it too. The only caveat is the need for more
strict file naming conventions.

Closes: #958

### Upgrading

If you use any custom classes like spouts, make sure they follow the
[PSR-4], namely the namespace should match the file path (even in letter
case).

For example, if you have custom spout class named `PrivateSpout` in
`spouts\private` namespace, it will have to be located in
`spouts/private/PrivateSpout.php`.

This also means each file can only contain a single class.

[PSR-4]: http://www.php-fig.org/psr/psr-4/

### Upgrading (developers)
Once you checked for compliance, run `composer install` as described in
the [development section] of README to switch to PSR-4 autoloader.

[development section]: https://github.com/SSilence/selfoss/blob/master/README.md#development
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The documentation on spouts doesn't mention composer autoload
1 participant