Skip to content
New issue

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

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

Already on GitHub? # to your account

Don't force objects to always pre-load (per composer.json) #32

Closed
tag opened this issue Nov 20, 2012 · 3 comments
Closed

Don't force objects to always pre-load (per composer.json) #32

tag opened this issue Nov 20, 2012 · 3 comments
Milestone

Comments

@tag
Copy link
Contributor

tag commented Nov 20, 2012

Paris should autoload when needed, rather than forced to load on every page request (as set in composer.json). This occurs because of the "files" key. See the relevant Composer documentation section for more info.

Better autoloading can be accomplished by renaming ./paris.php to (for example) ./src/Model.php, and modifying composer.json:

    "autoload": {
        "psr-0": {
            "Model": "src/"
        }
    }

This simple approach assumes OrmWrapper is used only as an internal class, and not accessed directly (unless Model is loaded first).

@kevinsperrine has a forked version that can be used as an example.

Similar changes should be made to Idiom's composer.json.

@treffynnon
Copy link
Collaborator

Thank you for the suggestion, but this would be a BC break. Paris and Idiorm are meant to be simple and one file only.

This would more likely appear in a version 2.

@tag
Copy link
Contributor Author

tag commented Nov 20, 2012

I understand your concerns about a BC break; those not using Composer would need to change their include path. I'm not necessarily suggesting classes be broken into multiple files (and it's not clear whether a strict reading of PSR-0 requires that).

I make this suggestion no only because it is useful to me, but also because it seems to be one of the most common changes I observed when browsing the githib network graph.

@treffynnon
Copy link
Collaborator

Closed by pull request #44

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants