Good implementations of MVC in PHP [closed] - php

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
I've done some development in RoR and I'm now trying to make something in PHP.
I think the MVC architecture is an ideal frame for my current project (users, application data, purchases, etc.)
Is there implementation of MVC on the web that is recommended or does PHP just not work in the same way as Rails and every MVC in PHP must be hand made?
My google fu is weak and I couldn't really find anything conclusive.

These four are MVC frameworks:
CakePHP
Symfony
CodeIgniter
Kohana
I prefer CodeIgniter and Kohana, because they're pretty focused and not bloated at all, and because they both, besides being MVC, are also big on the convention over configuration principle, meaning you don't have to go around maintaining XML/YAML/etc config files of your classes, URL routes, etc.
In particular I like Kohana because it has this nifty file system-based configuration hierarchy (they call it "Cascading Filesystem") which basically means you have even less configuration nonsense to maintain, because based on where you put your app's files (classes, config files, etc), the framework will know which parts of the system will be overridden. So I'd recommend you give Kohana a test run. Beware though, it's relatively new and the documentation is kind of weak, so if your google fu is indeed weak as you say, then you might be better off going straight for CodeIgniter, which has been around for longer and thus has more docs. But I'd still keep an eye on the Kohana project.
Symfony is... too bloated for my taste (i.e. having to run scripts in order to "generate views" and whatnot), but I've seen some large successful projects running on it.

Rails is an MVC framework, for PHP you could use CodeIgniter or CakePHP both of those use the MVC design pattern. CodeIgniter is the bomb.

You can find more discussion about PHP frameworks here: http://www.quora.com/Whats-the-best-MVC-framework-for-PHP
I haven't looked into other frameworks, I have found Codeigniter to satisfy most of my requirements from an MVC framework.

Sure, Theres Codeignitor and Frostbite Framework.. Both are good, and easy to find via google. Here is a whole list of php frameworks: http://matrix.include-once.org/framework/simple

Everyone else pretty much nailed it. The only reason I'm adding on to this question is because you use Ruby on Rails, and as such, CakePHP is going to be the most similar framework for you.
I use CodeIgniter because it's very well-documented and lightweight (with very little magic), but that's just my personal preference. Cake will be most like what you're used to.

I think laravel is best for you. Remember, frameworks are for SSBs Small scale businesses. For large scale businesses you write your own framework with all planning, execution phases etc.

Related

RESTful webservice with Silex PHP : good choice? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I have to create a REST API for a mobile application and I don't really know how to begin it.
I read some articles and tutorial about REST in general, but I didn't find a complexe API example written in PHP.
So after more researches I choose to use a micro-framework (rather than start from scratch). A full framework like Symfony2 or Zend provide some methods that I will not need, and I think they are too big for.
Because I already worked with Silex PHP, I choose it.
But one question stay in my mind : is Silex a good choice to create a (future) big API ?
The API will evolve and could be more and more complexe (understand more URI will be avalaible in future, because we have goal to migrate from SOAP to REST).
Since Silex PHP uses a single file convention, I'm a little scared to use it (because file will be more and more larger, and I supposed with performances falling).
Also I would like to cache on server results (additionally with HTTP caching) when necessary, to reduce queries to database (MySQL).
What do you think and what do you advise ? :)
Silex is not a bad choice for building out an api service. I would recommend maybe starting with Silex Kitchen Edition for some decent organization and other useful configs and strip out what you don't need. Also, I would look for existing restful projects written in silex/symfony. As far as scalability you should read this post from Igor Wiedler one of the creators of silex.
Silex is a microframework meant to be used in small projects. It's suitable for small websites with low traffic. It is also a good way to introduce yourself into some concepts like dependency injection, without introducing too many abstraction layers.
They've recently introduced the target in their website as "single-file apps", giving you a bit of the target scope for the framework.
I think it should be fairly accepted fact that Silex is not suitable for anything big.
Silex will not perform badly if your project works, but it will not be the nicest to work with once you start growing, as it will not help you too much. Symfony uses concepts you'll see in Silex and is a full stack framework you can use for bigger applications with lots of bundles, plugins and a big community there to help you.
Edit:
Note I cannot delete the answer as it has been accepted. I haven't used PHP in years now, since then, Silex has changed their approach from "microframework" to being just a library it seems. Whatever the case, the down-voting I believe must come from people involved with the project, probably upset of having created something which didn't take off as they may have hoped.
Just read the product docs, this was a request for an opinion which was given and accepted. I don't think this question belongs to stackoverflow anyway.

Any disadvantage to using Zend for a very small website [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I'm using Zend and want to know if there's any disadvantages to using it for a small website. The website is maybe 4 pages: a couple of forms and a couple of static pages.
Will Zend still speed up development for such a small website? or the opposite?
Does the whole bootstrapping flow and MVC structure and routing overburden performance for such a small website?
I see it being useful for a big website serving lots of content, but for a brochure website, does it still make sense to use the framework. It's sitting on the server so there's no initial cost to adding it to the project, but is there performance and implementation issues (maybe longer implementation time) for such a small project I'm not noticing yet?
I'm getting suggestions for other
frameworks. I'm sure Codeigniter,
Kohana, and modx are great, but they
require time to learn their API. I
already know and use Zend so the
choice is between it and plain PHP.
I opt for the framework on nearly all sites.
In my experience, a site rarely stays as small and static as one might think when starting out. Using the full framework on a small site might seem like overkill, but it still assists in rapid application development.
Even if the site - as currently envisioned - is only a few pages, those pages probably share a common layout. So use the layout/template functionality of the framework.
Handling the forms and their submissions is easier in an MVC environment. The framework helps there.
And ultimately I find it aesthetically pleasing to truly separate concerns: bootstrapping, controllers, layouts, views, etc. Gotta put all that code/information somewhere. Why not in a set of standard places?
The most compelling argument against using a full framework for a small site would be if you had to actually "learn" the framework to do it. But since you are already familiar with Zend Framework, there is no learning curve associated to getting up and running; you get the RAD benefits right out of the gate.
In short, I find that it's faster to use the framework and it gives me the firm foundation to grow the site.
It might speed up development, but it might be funny having a 27Mb library on a site with only 4 pages.
Do you really need a framework for a basic 4 page site? You say yourself that a couple of those pages will be static.
This seems like overkill to me. I don't see whats wrong with taking a no framework approach to such a small task.
I'm not sure if this will speed up development either, and a 4 page website (with a couple of static pages) running on bare bones PHP will be much faster then its framework counterpart, that is assuming no caching.
Zend is slower, but (at least in my case) it speeds up development. You can always use Request cache on such a simple website.
Use something like modx for speedy development of such a small site. Just delete all the example stuff and throw your content into the content management system.
I propose this for speed of development. As for performance it is likely slower than a framework like codeigniter.
In response to your edit:
Q: Which will be faster for
development?
A: Which are you more familiar with (Zend or standard PHP)? The final
answer depends on your level of
reliance on Zend to perform standard
php tasks.
Q: Which has better performance for static content?
A: Likely standard
php since you will only call the
libraries you need and no framework overhead.

where are the frameworks for creating libraries? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
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.
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."
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

which is best framework or technolgy for a community site development? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
which is the best framework to develop a community web site.
For the MVC architecture, is there any disadvantage while using frameworks.
or is it better to develop that in a pure php with OOPs concept?
thanks in advance!!
Do you want an MVC framework or a CMS?
For MVC frameworks, there isn't simply the best. It's always about what you need, but here is a short overview of the most common frameworks.
If you're looking for a CMS I'd suggest Drupal for community like functionality.
or is it better to develop that in a
pure php with OOPs concept?
If you really need that last little bit of speed, do it in pure php...
I'd suggest, use a good stable Framework like CakePHP, symfony or CodeIgniter. It'll help you avoid a lot of mistakes you'd make if you do it all by yourself and it makes development (not the page) a lot faster.
I switched from pure PHP to Django (python) and I cannot tell you enough good stuff about it. Using an ORM and automatic admin system was key for me and have saved me tons and tons of tedious work.
If you don't want to learn a new language there're probably some very nice frameworks for PHP as well.
Drupal is a very easy to use and extendable framework for building communities and MVC apps in PHP.
For simple sites you can try CMS, such as Joomla or Drupal or even others, wich will let you concentrate more on content than on programming/modeling.
As for MVC, frameworks definitely help, you do not need reinvent the wheel. Escaping strings, session handling, db access, views templating, web forms and other important stuff is done in formalized, dev community proven/tested ways. More to say, frameworks leave you with the freedom option to enhance functionality (e.g. inheriting/overriding/adding classes). So try download some of them, try a simple app, take a look at the docs, and decide if it suits your needs.
Personally, I have a good opinion of Kohana framework.
take a look on elgg , this is new and has lot's of inbuilt things, and easly extensible.
I think for a community-site the idea/concept of the site is much more important than the technology.
Many technologies are mature for web-development. I would pick the one, you most comfortable with. From the features they aren't very different and if the technology is actively developed, you can be sure, that it will adapt future ideas.
I suggest you use some MVC framework. CMS systems are nice, but a time will come when you'll want to do something outside of the box and you will have to create plugins. Now, all this is nice until you have to upgrade. And you do have to upgrade because security issues arise all the time.
Anyway, here are some frameworks that are IMHO worth considering. It's important to use one which is known and popular because:
more users will be able to answer your begginer questions
more users mean bugs are found and fixed faster
there is also more user-generated content, examples and documentation
CodeIgniter and its fork Kohana
CI has excellent documentation, a few very good tutorial videos and it's easy to be up and running in a very short time.
Yii framework
Has excellent documentation, and is very powerful. Also, it is very fast, and beats most other frameworks on speed tests by a large margin. It takes time to learn to use it well, mostly because there aren't enough examples, and you don't have such great video tutorials like CodeIgniter does.
CakePHP
I find it a little bit too restrictive (file naming, placing, etc.) but this could be good for a complete newbie, or a team (less chance for maverick developers to mess things up).
Yii comes with a full stack of features, including MVC, DAO/ActiveRecord, I18N/L10N, caching, jQuery-based AJAX support, authentication and role-based access control, scaffolding, input validation, widgets, events, theming, Web services, and so on.
Yii is easy to use and is extremely flexible and extensible. Id recommend to check its extensions like backvendor http://www.yiiframework.com/extension/backvendor/ or coco http://www.yiiframework.com/extension/coco/ Ive tried backvendor, it really helps to save much time on the first stages.

Is Symfony a better choice than Zend for a web development shop (10+) because it is a full stack framework? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
My team at work is considering to use a framework for developing web sites and applications. Some of the seniors are convinced we should use the Zend Framework because it is easier to pick-and-choose the features so the framework we will be light-weight.
I'm afraid however that they are only looking at the technical advantages that a lightweight framework will have. In my opinion it is better to have a full-stack framework (and I am a proponent of Symfony) because
It will also provide us with a standard way of working without writing new documentation.
If we would like to use new features we would only have to read the documentation to see how it can be used instead of having to build it into our setup of Zend first.
I don't expect all my questions to be answered by everybody but this is what I am looking for in the answer:
Do I have a point here?
Have you been in a similar situation and how did you handle that?
Do you have more arguments that I could use OR could make me reconsider my own opinion?
The context:
I work at a small shop with about 10 programmers. We mostly program PHP. We use a really simple inhouse developed framework and ORM library that are practically undocumented and lack anything but the most basic features (no validators, no transactions, no caching, no authentication)
And why not both? I have been using symfony since 2006, have been a real Doctrine fan for one year, and for a few months, we've reach many steps on the productivity ladder by integrating Zend components directly onto our symfony applications.
The real strength of symfony lies on the decoupling of everything, and the easy extensibility of the framework. You can replace almost every layer of the whole thing. Just copy/paste the Zend directory in /lib/, and add this singleton in /config/ProjectConfiguration.class.php:
static public function registerZend()
{
if (self::$zendLoaded)
{
return;
}
sfToolkit::addIncludePath(sfConfig::get('sf_lib_dir') . '/vendor', 'back');
require_once(sfConfig::get('sf_lib_dir') . '/vendor/Zend/Loader.php');
Zend_Loader::registerAutoload();
self::$zendLoaded = true;
}
And use freely any Zend component you might like.
You might be interested in the new Jobeet tutorial, and especially at the Search part, which uses Zend_Lucene_Search.
Symfony is really easy to use and can get a fully functional site with sessions, caching, unit and functional testing, automated deployment and more up and running in a very short amount of time. You only really need to worry about code to access and display your data. Whist it may not be as lightweight as a roll-your-own implementation, the amount of code you have to maintain will be less.
The Propel/Creole ORM works well, has built in validators etc and is set up to be extensible out of the box.
When transitioning an in-house framework over to Symfony I was able to re-use lots of library code simply by putting it in one of the lib directories that Symfony scans at startup.
Although I've not used it, there is a Zend bridge built into Symfony that allows you to use Zend modules if needed.
Hope that helps.
I think the ZF documentation and community involvement is better. I also like the naming scheme, coding standard and extensibility of it. ZF also seem to get a lot of new features and improvement to existing classes like an open source project, from many different people working on their own pet projects.
I don't really see how Symfony is an advantage for a group of 10 programmers. Clearly you should be able to relatively fast set up a default configuration for new projects, and have lots of extensibility built on top of and in addition to ZF.
How is ZF not "full stack"? It seems to contain every element Symfony does, and then some. Moreover ZF has a "pick your poison" approach, allowing you to use different pieces in different methods. (As an example, we use Zend_Config in lots of different places, just so everyone can expect a reasonably uniform configuration system, even on tiny pieces of code).
I'm afraid however that they are only looking at the technical advantages that a lightweight framework will have. In my opinion it is better to have a full-stack framework (and I am a proponent of Symfony) because ...
It depends a lot on the type of application(s) you're building. If you're building a lot of low-complexity, mostly content-driven applications, then Symfony will shine. On the other hand, if your application doesn't fit into the naked-object paradigm of Symfony (For example, if it's complex and not entirely focused on content management), you may find it more of a hurdle, than a help.
I have limited experience with either, but a good starting point for setting "standards" for Zend is to follow their tutorials for using the different modules - many of them give sane defaults that work for 99% of the projects out there.
I would say it comes down to what you need it for - Zend for flexibility, Symfony for a quicker start and pre-developed standards if your project has no extraordinary needs.

Categories