Take the 2-minute tour ×

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!

share|improve this question
add comment

closed as too broad by LittleBobbyTables, andrewsi, Undo, Ruchira Gayan Ranaweera, Sergio Aug 19 '13 at 5:24


3 Answers

up vote 4 down vote accepted

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.

share|improve this answer
add comment

I think there are frameworks that meet your needs. Developers make a distinction between full-stack frameworks and more component-based frameworks.

The component-based frameworks include a collection of more fine-grained components that can be used more or less independently. Examples are configuration, authentication, email, web services, etc.

If you're talking about a framework that makes it easier to develop those components, I'm not sure what the value is there. Frameworks provide value by abstracting common code that they're sure you're going to need. What's the common code between an authentication component and an email component?

Frameworks increase developer productivity for well-known tasks. The more specific and well-known the task is, the more the framework can assume it knows how to do it. Example: Drupal or MediaWiki.

But frameworks don't do OO design for any arbitrary code for you. That's moving in the opposite direction, away from more specific, and toward broader tasks. It's hard to identify the common code that can be abstracted from such a broad set of technology as "libraries."

share|improve this answer
add comment

Most of what you describe is called software engineering. It's the essence of using base software and language tools to form a complex solution. As far as making it easier and abstracting away the repetitive parts, that's what most modern languages do try to do.

I guess the answer to your question is: Python, .NET, Ruby

share|improve this answer
add comment
