当前位置: 动力学知识库 > 问答 > 编程问答 >

Is there an MVC PHP framework designed for an packaged product?

问题描述:

The "Framework" question has been asked a bunch of times here but having read everything I can find, I can't find the answer to this question.

I'm creating everything from games, to CMS's, social applications, etc. I've used Zend and CodeUgnighter briefly, but when I deliver it, its going to have a bunch of unnecessary folders and it requires anyone who wants to modify my program to know the framework, and they've got a mountain to move if they want to update it to the latest version of the framework.

It just seems to me that frameworks were designed mostly for super large projects where its being designed for one customer, not a released program. It seems like all the big packaged php products out there make their own frameworks (vbulletin, etc).

网友答案:

its going to have a bunch of unnecessary folders

These uncessary folders are stored in one folder and are needed for the framework to work, is that the 10, 20, 200 Mb which is problem? Storage is cheap nowadays, why cares?

it requires anyone who wants to modify my program to know the framework

You got it! It is an advantage, not an inconvenient. If it doesn't, the guy which will read your code will need to understand your habits, your convention, and they probably are not so common. If you are able to write consistent code, following any conventions, why not. But it can also gives your customer a real plus value since he knows that anyone could take back your work if you have to leave for any reasons.

they've got a mountain to move if they want to update it to the latest version of the framework.

In any case upgrading a framework, an application to a new version is most of the time a moutain since in a production environment, you need to test, and test again, to be sure your application is stable. Most of the framework give releases notes which should let you know about backward compatibility.

It just seems to me that frameworks were designed mostly for super large projects.

Zend or Code Igniter fit well for medium sized project, with time you developed framework extensions and you'll be able to save time and bugs on smaller project.

It seems like all the big packaged php products out there make their own frameworks (vbulletin, etc).

PHP framework are youngs, most of them are 3/4 years old (Zend, Symfony). A lot of application like Vbulletin are older.

There a lot application based on common framework, but they don't target the same people.

Joomla, Drupal, Wordpress have their own framework (procedural, or object) but they target more the end-user.

However a solution like Magento, which uses Zend Framework, is designed to be extended and very customizable with extensions.

网友答案:

There are many light-weight PHP MVC frameworks, each with varying degrees of features and flexibility. The majority of these are going to be lacking advanced features, but will get the job done.

One that comes to mind is: http://www.kissmvc.com.

Hope that helps :)

网友答案:

You're right that most frameworks are tailored towards 'one size fits it all', meaning they have a lot of stuff that you won't necessarily need on every project. Which sometimes makes them a bit heavyweight. More 'modern' frameworks DO have a strong focus on modularization, but when it comes to the core there are often a lot of inter-dependencies.

One solution: Roll your own framework, dissect code from other frameworks and use parts you like/need. If you can, lean more towards using libraries that focus on specific tasks that you need. E.g. ORM for databases, you might as well use doctrine since it's area of expertise is very focused. Just as an example.

Either way, if you do it right it's a lot of work upfront trying to figure out what you even need. Start with the basics, how do your controllers work, do you need the full implementation of MVC with front controllers, action controllers, maybe page controllers for a CMS? Where can you cut corners, where not? It really depends a lot on what YOU need for your specific product (or product palette).

The other solution, like Serge mentioned, is getting a lightweight framework which really just focuses on the basics. And fill all the holes yourself, or by using 3rd party libraries where they are available.

I personally use a heavily modified version of FLOW3 (currently in alpha development) which uses a lot of cool stuff, but lacks a bit when it comes to using legacy databases (they have their own domain model implementation). Which is what I changed mostly for my version.

分享给朋友:
您可能感兴趣的文章:
随机阅读: