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

Proposal for Standardization of PHP Library Directory Structure #979

Closed
De54 opened this issue Apr 20, 2024 · 1 comment
Closed

Proposal for Standardization of PHP Library Directory Structure #979

De54 opened this issue Apr 20, 2024 · 1 comment

Comments

@De54
Copy link

De54 commented Apr 20, 2024

Hi,
Most PHP developers, when starting a project and requiring a PHP library, include it alongside their project files using Composer or manually. Now consider the following scenario:

1- Developer D1 develops project A1 and includes library files X within their project.
2- Developer D1 then develops project A2 and again includes library files X within their project.
3- Developer D2 develops project A3 and also includes library files X within their project.

As illustrated in the above scenario, library files X are duplicated on the computers of both developer D1 and developer D2. This redundancy is not efficient in software development, especially when it comes to maintaining consistent versions of libraries across projects.

The proposed solution involves establishing a standard directory structure for storing PHP libraries, adhering to the Filesystem Hierarchy Standard (FHS) as a reference. For instance, all PHP library files could be stored in /usr/share/php/libs/<lib-name>/<version> or /usr/share/php/libs/<lib-name>. I invite all PHP developers to adopt this standard and transform it into an international norm. Furthermore, I request PHP to officially recognize this standard and create the corresponding directory upon PHP installation for user convenience.

However, this is not sufficient. It would be even more beneficial if PHP developers, in general, adhere to directory structure standards such as the Filesystem Hierarchy Standard (FHS) for various aspects of their projects. For example, configuration files could be stored in /etc/project-name, log files in /var/log/project-name, temporary files in /tmp/project-name, and data storage files separate from the main source code in /var/lib or within the /home directory. The source code and related files could be stored in /lib.

I urge all PHP developers to adopt these standards and transform them into international norms. I also call upon PHP to officially recognize and incorporate these standards. For instance, in future updates, PHP could introduce a function that eliminates the need to manually include libraries from the /usr/share/php/libs directory. Instead, developers could call the function with the library name and version to invoke the desired library. Example:

import(<lib-name>, <version>, <include-file>);

Usage example:

import("dispatch", "11.0.0", "dispatch.php");

I hope that this standard will be accepted by the PHP community and recognized internationally so that we can effectively organize our projects and put an end to the graveyard of redundant files once and for all.

@pronskiy
Copy link
Contributor

This is a website repository. PHP-FIG would be a better place for such proposals: https://www.php-fig.org/get-involved/

@saundefined, close?

@saundefined saundefined closed this as not planned Won't fix, can't repro, duplicate, stale May 23, 2024
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

No branches or pull requests

3 participants