Whenever I create a PHP library (not a framework) I tend to reinvent everything every time.
“Where to put configuration options?”
“Which design pattern to use here?”
“How should all the classes extend each other?”
and so on…
Then I think, isn’t there a good library framework to use anywhere?
It’s like a framework for a web application (symfony, cakephp…) but instead of creating a web application, this framework will help coder to create a library, providing all the standard structure and classes (observer pattern, dependency injection etc).
I think that will be the next major thing if not available right now. In this way there will be a standard to follow when creating libraries, or else, it’s like a jungle when everyone creates their own structure, and a lot of coders just code without thinking of reusability etc.
There isn’t any framework for creating libraries at the moment?
If not, don’t you agree with me that this is the way to do it, with a library framework?
Because I am really throwing a lot of time (weeks!) just thinking about how to organize things, both in code and file level, when I should just start to code the logic.
Share your thoughts!
Ah well, now Bill basically said everything I was going to say, but anyway. I can throw in some links:
If you want something you can just throw into to your webroot and start coding your application into, you are looking for a full-stack framework that strongly uses Convention over Configuration. From the modern frameworks, Symfony comes to mind.
If you want standalone components, look for component libraries like Zeta Components (formerly ezComponents) or Zend Framework or Symfony Components (includes a DI framework). You can reuse these or extend them to add additional requirements. Or use Doctrine if you need an ORM. And don’t forget about PEAR.
However, how you use the above or what you do with them is nothing you could download somewhere. Architecture and Design is the task of the developer (or architect). You cannot download that, because it likely won’t fit your application without heavy modification. Patterns, like the GOF patterns or the PoEAA patterns offer guidelines on how to solve problems on a general level, but you always have to adapt them to your application.