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

migrate to PSR-4 namespace and use Composer in production #261

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

stklcode
Copy link
Contributor

@stklcode stklcode commented Mar 31, 2023

This PR is WORK IN PROGRESS and not yet ready to be merged.


This proposal does change the project structure and class names.

First we introduce a Pluginkollektiv\Statify\ namespace and move the classes into it stripping their prefixes, i.e. Statify_Frontend will become Pluginkollektiv\Statify\Frontend.
Then we introduce a PSR-4 autoloader with Composer and replace our custom autoloading function.

ToDo:

  • Find a different way to minify our CS/JS resources, because this currently requires dev-dependencies, so the mechanism is not yet suitable for production.
    • Might be a pre-commit hook that generates them, so they are kept in the source tree while still be automatically generated.
  • Point third-party CSS/JS to the vendor directory.
  • Discuss, whether we want to go that way (probably do this first place)

Remove the "Statify_" prefix from classnames, so Statify_Frontend is now
located at Statify\Frontend.
Disable the corresponding PHPCS rule as it conflicts with PSR-4 standard.
Remove the custom autoloader function.
@chesio
Copy link
Contributor

chesio commented Apr 1, 2023

A small suggestion: I would stick to Vendor\Product scheme for namespaces as this scheme is well-established in PHP world and use Pluginkollektiv as vendor name, so the new namespace would be Pluginkollektiv\Statify. This lessens the risk of namespace collision to practically zero as Pluginkollektiv is also well-established name in PHP world... :-)

@stklcode
Copy link
Contributor Author

stklcode commented Apr 1, 2023

Good point.

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 18 Code Smells

No Coverage information No Coverage information
1.7% 1.7% Duplication

@pluginkollektiv pluginkollektiv deleted a comment from sonarqubecloud bot Sep 17, 2023
@florianbrinkmann
Copy link
Member

I would vote to go with the minimal approach from #260 for now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants