My Content Management System [closed] - php

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 6 years ago.
Improve this question
I intend to develop a Content Management System (CMS) like shown in the figure below;
Figure: Intended CMS design
Is it possible to completely develop it using PHP's standard library?
Do I need to use a PHP web framework? If so, why and what framework is ideal?
I hope to use MySQL as backend.
I hope to use below technologies as front end;
HTML5 and CSS3 - hard code by myself (Is there any framework or something make it easy? I heard something lesscss.org)
jQuery - to make HTML elements functional
Ajax - to avoid page refreshing
Bootstrap - to make my CMS responsive
Are there any technologies I do use, or any suggestions?
I prefer to improve my HTML, CSS, PHP and other technologies by learning and hard coding. So I hope not to use CMS like
joomla, WordPress, etc. Am I right?
Please note: I've already searched Google extensively before I put my questions here. But I am unable to confirm what I do next. Your comments are appreciated.

Your questions really look well researched and I think everybody with the intention of building a custom-made CMS has come to this point where they ask themselves these fundamental questions (in other words: good questions!). Now to some answers:
1) Yes it is possible.
2) Although building a CMS in pure, native, hard-coded PHP is possible, I wouldn't recommend it for production. You could do it, and you would largely profit from the experience, but there are many little problems (like Routing / User-Management / Authentication / Communicating with Database / Form-Building (like in your screenshot) / etc.) that are already solved by a good Framework.
Also as you are a beginner, you are naturally overwhelmed by the problems and decisions you have to solve/make. This is also a good point why a framework would be a good starter. Although some solutions are sometimes a little too opinionated, they still give you a good structure to start with and most of the times follow best practices of our industry.
Which framework is the most ideal for your project, you'll have to decide on your own, based on your requirements, but some common ones are:
Symfony (probably the most known and most used php-framework, but also very abstract / I would recommend this on a really big project, where you work in a team and you are aiming for flexible maintainability)
Laravel (excerpt from their website: An amazing ORM, painless routing, powerful queue library, and simple authentication give you the tools you need for modern, maintainable PHP.)
Silex (the little brother of Symfony, info from their website: Silex is a PHP microframework for PHP. It is built on the shoulders of Symfony2 and Pimple and also inspired by sinatra.)
FatFreeFramework (from their website: A powerful yet easy-to-use PHP micro-framework designed to help you build dynamic and robust web applications - fast!)
As I used Silex myself many times and also when I began with best-practice PHP, I recommend to start with it, if you decide to write your own CMS. I pretty fast did some Management-CMS similar to your screenshot with it (with their Form-Builder) and was happy with the result.
3) Again this is up to you. For the backend you will probably use MySQL anyway, if you just need a database. In the frontend using HTML5/CSS you could try jQuery and Bootstrap (and then here their less or sass implementation).
If you really don't have too much logic for your JavaScript, you could also try to just use native JS, without jQuery. This way you will also learn more about the language and have less vendor-dependencies the user has to download.
4) If you are really up to learning a lot, then yes, you should probably hand-code everything yourself. This way you also have total control of what code gets delivered to your user. That's a problem with most common CMS: they pollute your code through some other plugins or something and you quickly loose control over your output.
But if you need to be fast there are also CMS that address this issue by giving you total control over your output and giving you creative freedom, like MODX does.
In the end it is up to you and especially the needs of your project. If it's a simple website and you conveniently want to edit the content and also have some starter-help, then I recommend to use a CMS.
If you really want to learn about all this stuff and you have some special needs, then go on and code your custom-coded application. In any way: good luck! :)

Related

Is AJAX enough? Should I learn a PHP framework? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I started learning programming 4 months ago. So far I already know some javascript(and jquery), php, ajax html and CSS. Yesterday I saw for the first time in one of the stack forums a question about PHP frameworks (zend, codeigniter...etc).
I hope these questions are not very stupid, because I am a beginner so I don't know much about this world yet, but my questions are:
1- Do I need to learn how to use a php framework if I just one to build ONE website?
2- Do websites nowadays rely more on AJAX + some php OR just PHP + some javascript?
3- How long does it take to learn and master a php framework like zend?
1) You don't need to learn a PHP framework, and in fact if it's the first website you've ever built I'd suggest building it without a framework just to get a feel for how PHP works when building a site. This way you understand things like database connections, session management, etc. that is often done behind the scenes with frameworks. Then later on try building it with a framework to get an idea for the design patterns and other features that a framework has built-in to avoid code repetition, security holes, etc.
2) I don't know what the difference between AJAX + some PHP and just PHP + some javascript. AJAX is a part of Javascript, it isn't a separate technology on its own.
Some websites use a lot of AJAX, some don't. It really depends on what you want the website to do and your particular design: AJAX can provide a smoother feel to the site, but can have complications when it comes to things like back buttons and bookmarks.
3) Depends on what you're doing with the framework: if you're only using 10% of the features you certainly won't become a master in any amount of time. It also depends on the complexity of the framework: I haven't used Zend but I know that the more complex the framework, the longer it will take you to learn it.
Learn as many thing as you can. PHP is a good start, becouse it's very popular and easy to learn and use. There are many great frameworks written in PHP (Symfony, Zend, Kohana, etc.). However, it's not a nice, well designed language at all. Keep it in mind, don't stop at php, learn it then make progress.
b) You will be able to build a large variety of sites with PHP+JS+HTML
ps.: AJAX is a technology, and as a knowledge, it doesn't worth so much as is.
Ajax is just a technology to call server side scripts from Javascript. The server side script being PHP. So, if you intend to use Ajax, you need to know PHP.
As for PHP frameworks, its good to build a few website from scratch using PHP to get a better understanding, but eventually, its better to adopt frameworks. Frameworks implement a lot of the functions and methods you need. No point re-inventing the wheel.
The answers to your questions are very subjective, but what I suggest is:
No you should not learn a framework to build one website. Just go and build it in any way you can. Frameworks usually carry a lot of additional concepts and methodologies. You will have to invest quite some time to understand how they work, but it will be really hard to understand why they work that way. Doing a website is a great experience, so just go and build something.
Lets say websites mostly rely on HTML / PHP / JavaScript. Ajax is just an additional capability, which you are already focusing too much. It's great that you know what Ajax does, but you should concentrate more on the essential things, like number one.
Lets say it takes two years of constant interest in the field. So at first you learn the syntax of PHP, then you start to know how HTTP works, then you experiment with HTML and JavaScript/jQuery/Ajax a bit more, then you try a Framework. You keep trying until you become a master. Zend Framework is one of the most comprehensive, so it will take a while to study how it works and all the related technologies it brings with it.
My final advice is to stay focused, build something, see what challenges it brings, solve those challenges and eventually become a master. Good Luck!
Question One - The short answer is: it depends on the type of site you're building. The frameworks you're talking about were built to streamline web application development, which make extensive use of databases and object-oriented principles. If you're planning on building a site with mostly static content, I wouldn't bother learning a framework just yet.
Question Two - Again, it depends on the site. The concept of AJAX has many applications, but most sites employ it to make a site more interactive (e.g. not refreshing the page to load new content). For sites with primarily static content, AJAX has fewer uses.
Question Three - It can take a while to 'master' a framework. I'm not that familiar with the ones you mentioned, but learning a framework is less about understanding it's syntax/quirks and more about learning how to approach a problem their way. Again, it depends on what you're doing.

php framework help [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
Ok so before anyone states the fact that the php framework question has already been answered, note that I am asking questions specifically on which framework would be best given the requirements that I am providing. I am currently in the proccess of building a large project. I will be in the future working on several medium/large and a few small projects. I am an experienced php developer and fully know OOP inside and out and have a great knowledge of mysql database so learning a system is not a problem.
Now that is out of the way down to what I am actually looking for. I have currently been using a "framework" that is not so great and was provided to me for my projects. I would like to get rid of the "framework" and actually start using an actual framework. I was thinking of building my own framework but was considering (and really leaning towards) using an already preexisting framework. I have looked at a bunch of frameworks and even played with a few of them out there. Once I choose a framework I am going to want to keep using it and not have to switch 6 months down the road so before I choose I will be doing some thorough testing before making the final decision. I would like to get some input from some users as to which ones would fit my needs best.
In a framework I am looking for the following items:
Speed - because of being larger projects I will need to keep speed in mind. I can write efficient code but if the framework is slow it really wont matter now will it :)
Authentication - I would like to be able to use some built in authentication if possible through the framework. I dont necessarily need granular permissions based on users but more or less through groups (granular permissions is not a turn off just not a requirement).
Ajax - I like to use ajax in my applications so I would like some kind of ajax implementation in the framework and personally I prefer jquery. It doesnt necessarily need to have built in ajax features but a way to kill the page with the ajax output before anything is output for efficiency.
Forms - I have seen that alot of frameworks have built in features for managing forms but just thought I would mention it here to save myself the headache.
Administration - This is possibly one of the most required features that I really need. I need to be able to create a backend to manage the site. I dont want to have to hack something together to make this work.
Api - I will be in need of an api for accessing/modifying data that I will be allowing.
Database - Built in database methods. Doesnt necessarily need to do it automatically, just give me access to be able to retrieve/update the data that is need.
These are not neccessarily requirements but more or less nice features:
I would like to be able to encase all of my data that goes with a certain item into a "module" of a sort. So that I could easily copy it to another site and have it all ready to go.
An easy to navigate structure. I would like to be able to go into controllers and not see 50 files but instead see maybe 10 folders with the files encased in the folders so that it is better separated.
I cant really think of anything else at this time but if I think of anything else I will update the post. I would really like to get feedback from people who are using any frameworks out there. If you havent messed with a framework please do not recommend it as you have no experience with it and will not know if it would suit my needs. Any help is appreciated.
EDIT:
I just wanted to edit this post to clarify some stuff. In the requirements/features that I am looking for I do not necessarily need all of the features to be built into the framework. From some of the responses it seemed as if people were thinking that all of this stuff has to be pre-ready. I more or less am looking for a framework that supports all of the features that I am looking for that is easily accomplished with the components in the framework. For example the administration, it does not have to have a default administration area but allow for me to create an administration easily from the components that I will be adding to the site.
From my own experience ( CodeIgniter , Zend Framework ), but realy all major frameworks will allow you to do everithing you asked .
Speed - CodeIgniter is the fastest i worked with , this is not the strongest feature of ZF , in fact where i work we all got to the conclusion that ZF is slow .
Auth - Zend Framework handles auth better than what i saw in other frameworks
Ajax - All major Frameworks will allow you do disable the layout/view , Zend is slightly better here , as you can have special json views.
Forms - CodeIgniter framework handles forms easyer than ZF , however all frameworks should deal with this problem with ease . Symfony needs to be mentioned here with it's form generator .
Administration - Symfony just becouse it has a nice crud form generator based on the tables you're passing ( "admin generator" how they are advertising it ) , witch will speed development quite a bit .
???
Database - ZF handles databases nicer in my opionion , however i've heard good things about Symfony too . CodeIgniter here is not that strict witch is not a good thing in my opinion .
Modular App - Building modules in ZF is realy easy , and the feature that i like most is that a module structure looks like the whole app itself ( eg. the whole app is a module ... )
Easy to navigate structure - All of them once you are used to it , however i don't like the fact that CodeIgniter keeps all it's controllers in one place , when in ZF you can add modules and separate things from one and another .
Well, I worked with several PHP frameworks in the past and there aren't many good frameworks. You could risk a look at Zend Framework
ok
ok (but not enterprise level)
ok, but dojo
complicated
no, its a framework, not an application
ok, but not really a ERM
encapsulates PDO in an ugly way (bad implemented factory pattern)
ZF is developed by Zend itself, but I wasn't really happy with that too, because it has a lot of shortcomings (cruel DBAL, complicated form handling, supports dojo instead of jQuery) and if you are used to Java/JBOSS or .NET it just sucks (only mentioning this because you are planning a big project).
If you have some time until your project needs to be deployed and if you dont need to start immediately, you could also try FLOW3 (still alpha) which is developed by the TYPO3 Team. I've played a little bit with FLOW3 and can say that it is the only PHP FW which has at least a good architecture and some good ideas/paradigms (AOP e.g.).
If I understand you in the right way you would need something like a CMS for your backend. Maybe it would be a good idea to evaluate exiting CMS's and check out if you could extend them (use the CMS as framework (TYPO3 e.g.)).
You wont find a FW that matches exactly your needs, therefore you should consider choosing a CMS/FW and customize it in the way you need it. If the project is as big as I imagine there should be enough resources for such task.

Are there any PHP *websites* that have made their source available? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
It's not hard to find example PHP code. The problem seems to be that most of it is frameworks/libraries/etc. This is great, but I'd like to see an example of an actual website.
This stems from my perception that I can't build anything but "toys." My websites tend to be fairly CRUDdy, and it feels like my sites are a bit of generic MVC stuff and a lot of "SELECT" and "INSERT" statements.
I just want some assurance that I'm not "doing it wrong" since these are personal projects, and I'd like to use them to get a job.
Below is a good site that also make its source available (which is very well commented and easy to follow/understand, from a Zend Framework standpoint)
http://www.dasprids.de/
Instructions/info for the source
http://www.dasprids.de/behind-the-site
Actual source
http://site.svn.dasprids.de/
Check out MediaWiki. That's the same software that runs Wikipedia, and it's open source.
It's worth noting that the php.net website is itself open source.
What about PHPBB, which is neither a framework, nor a library?
There are also plenty of Open Source websites you can find just by making some search. Especially blogs, content management systems, etc.
Edit: responding to the first comment to my answer, I want just to add that looking at Open Source websites would probably help to have an image of what large (or not so large) projects are, and also how things are done by experienced developers (for example using PDO, SQL transactions, templates, etc.).
But please take in account that most of the time, those projects are developed by several people. And since PHP does not have any coding standard and does everything possible to force the people to not use good practices, large, collaborative projects are not so good at improving your coding standard nor learning good practices. For this, books may me much more helpful, especially books about good practices.
It may be worth looking at wordpress. I haven't looked at the php behind it, but I know I learned a lot looking at the DB definitions.
Usually a framework is a good compromise between writing quality code and performance. Larger websites that need scale come up with their own custom hacks which eventually evolve into frameworks. In my experience writing in pure PHP it's too easy to go the quickest way to implementing a feature and end up with a mishmash of code, but others might be more disciplined.
It's not hard to find example PHP
code.
Good point is that you know how to find code. You said your code ends up in a generic MVC and CRUDdy, i think this is what most of the web applications around are doing. But the important thing to consider here is they do these MVC/CRUD stuffs in managed way and following standard Object Oriented Design Patterns.
If you want to get examples of real PHP applications then search for open source codes for that specific type application and not frameworks/libraries. Frameworks/libraries are a bunch of PHP CLASSES combined together following the application design architectures and they are supposed to provide you a code base to start your new project with existing set of usable codes, not that they give you the "application feel" rather "structured feel" at the starting point. But once you get along these frameworks/libraries working together to provide you a structured way to build your application, things will really ease later. Your job is guaranteed ;)
If you want to develop codes with these MVC frameworks then start with Codeigniter. It is well documented and as you stated your existing code turns out to be like MVC, you'll grab this framework and how to build with it in one shot. I've written a Hello World in Codeigniter you can refer to start with it. (Also Refer: Codeigniter Documentation)
To find code for real application (not frameworks/libraries) you might think of slightly changing your search queries, search for categories of web application or alike you want to see, not just for the code to do this and code to do that, always search for the better and efficient ways to code and develop things. Github, Sourceforge.net, Google Code are really great places to search for "real" & "cool" open source PHP applications.
Well, actually you can learn a lot by studying a solid framework like ie. the Zend Framework. If you would like to learn that I suggest you first have a look at the Zend Framework Quickstart and then start reading Surviving the deep end. Once you covered these, you should have learned the basics of the Zend Framework, and then you can start looking at open source projects that use it. As far as CMSes go, there are a few using the Zend Framework, like TomatoCMS and pimCore.
BTW Creating a website isn't exactly rocket science, most sites are in fact just a collection of dull CRUD screens (sometimes spiced up with some AJAX to deliver a better user experience) that are used to add content to the site...
On beta.mkforlag.com, where I try out new ideas and develop new pages and new layout for the main domain, most of the source code can be seen. Most of the site is in Swedish, but most of the php code (comments, variable names etc.) is in English.
You should also keep in mind that although I've been using PHP a couple of years I'm no PHP expert and most likely "doing it wrong" in many cases. If you're not that advanced, though, you may find at least some of my code useful.
My code of satya-weblog.com is almost live. I am using wordpress V 2.9, so download that and you know about my site!
Check at symfony framework also and you come to know of propel, yml etc

Going from a framework to no-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 7 years ago.
Improve this question
I've been developing in PHP for about 8 years as a hobby. In 2009, I picked up codeigniter and since then I've not managed to get a single project developed.
I find it slows me down trying to work out how to modify it to work the way I want, when if I was working in pure PHP, I'd know, or I'd be able to quickly find a snippet for.
I've tried CodeIgniter, Kohana and Symfony. I love the ease of use (and I've also started using doctrine as an ORM which massively sped up my database work), but I find projects are taking me 3-4 times the amount of time it took in pure PHP. I get bored and frustrated when I can't find a solution to a problem I've previously solved in pure PHP.
Has anyone gone back from using frameworks to a no-framework approach. Is there anything like a basic security framework (prevent XSS, filter posted data, provide a cleaning function for use with databases)? I think something like that would benefit me much more than a full scale framework. I think learning to work with frameworks has taught me a lot, but I'd be happier working with my own code.
Current versions of PHP5 include much of the security framework you're looking for as part of the standard library.
Use filter_input_array to declaratively sanitize stuff coming in from the outside.
Access your database via PDO with parameterized SQL to prevent SQL injection attacks.
Use the following PHP settings to make your site more resistant to session fixation and cookie theft:
session.use_only_cookies (Prevents your session token from leaking into the URL)
session.cookie_httponly or the httponly attribute to session_set_cookie_params() (Protects against scripts reading the session cookie in compatible browsers)
More suggestions and PHP example code available on Wikipedia.
You can also use the httponly attribute with setcookie().
Nothing fancier than basic templating and header-setting is required for new HTTP and HTML5 features:
HTTP Strict Transport Security (Helps protect against WiFi exploits.)
X-Frame-Options (Restrict embedding of your pages. Good against phishing.)
HTML5 IFrame Sandbox Attribute (Sandbox 3rd-party ads/badges/videos. Already in WebKit. Likely to be at least partially implemented in Firefox 11.)
Content Security Policy (Firefox 4's new security framework, complimentary to the sandbox attribute. Now also being implemented in Chrome.)
If you're accepting HTML as input, I recommend grabbing HTML Purifier and calling it via a FILTER_CALLBACK line in your filter_input_array setup. Its whitelist-based approach to input security makes a great (and very powerful) first line of defense against XSS.
As far as I can tell, PHP doesn't come with a mechanism for protecting against cross-site request forgery, but I'm sure Google can help you with that one. The OWASP Security Cheatsheets include a section on it if you want to implement your own protection.
Out of curiosity, I decided to also start looking at standalone components and here's what I've found so far:
Templating:
PHP Template Inheritance (Regular PHP plus template inheritance)
TWIG (Django/Jinja2/Liquid-style syntax including autoescape and sandboxing. Compiles to cached PHP for speed.)
Dwoo (A faster, more featureful, PHP5-ish successor to Smarty. Includes a compatibility system for existing Smarty templates.)
Stuff I still haven't looked into properly:
Route dispatching (Only found RouteMap and Net_URL_Mapper so far. Thanks, cweiske.)
ORM (Just in case bare PDO isn't your thing)
I don't believe in frameworks... I have worked in many of them.
Reasons for hating MVC frameworks:
1) Code bloat, I purchase premium classes that assist me in development. Such as form classes or SQL classes.
2) I believe that MVC frameworks are not easily portable especially when using dependency managers.
3) I believe that you actually write more code with a MVC framework then if you had to use a boilerplate with a ton of useful classes that handle authentication etc.
4) Most frameworks also cater for just one or two databases natively.
I would suggest finding a form framework with authentication and text editor & a sql framework like madoo + a email class...
90% of your application is always forms , sql & ajax CLASSES - the rest can just be acquired when needed
I am a minimalist and I struggle with the idea of having code in my application that is not doing anything ... just in case I need it does not work for me.
With that much experience behind you, you must have your own set of favorite libraries, hand pick them and come up with your own simple framework. Framework or no framework (and which one at that) depends on the kind of project at hand, no glove fits all. So i would strongly suggest that if you feel that the existing frameworks are slowing you down, spend sometime and come up with a framework which works as per your needs.
Based on your statement that you've been using PHP as a hobby, as well as your profile statement "Slowly getting there", this seems like a learning curve issue. You don't appear to have the depth and breadth of experience to a) understand how to work within the structure that the framework imposes and b) you are thus unable to benefit from the efficiencies that the framework enables.
I urge you to stick with it. Go back to the beginning with the video tutorials. Find and read other peoples code until you understand it. Build your projects from the bottom up - start simply, and add functionality. Follow the forums, trying to answer questions yourself before reading replies.
I've been programming professionally for almost 20 years, across a variety of platforms, and it still took me a while to become comfortable with CI. But now that I am, I wouldn't go back to pure PHP (for my own projects) unless I had a site of sufficient scale that it exposed quantifiable performance issues (think Twitter).
Zend Framework is really super for that. You can use as much or as little as you want. Its all coded in php and open sourced so you can just hack at it and make it your own. The different component are not dependant on eachothers as much as in other frameworks.
You could build yourself a simple framework using some components from Zend without any problems.
Check it out!
I Know exactly the way you feel. I started 4~5 years ago in PHP (I came from Delphi, lol), and started in pure php. What I had back them was a "CMS Panel like" wich just read all tables fields and create the form. After sometime I reached somehow in the knowledge of PHP Frameworks, I tried CakePHP for first and didn't liked, after, got into Yii wich in my opinion is pretty intuitive and easy-use (With it's Gii generator it rocks pretty much). I Tried Symfony, ZF2, Laravel, Yii2-Beta and some frameworks for RAD, but still I wasn't feeling fast enough like before the frameworks.
Happened that I developed my own framework (It was naturally, not exactly that I woke up some day and said "I'm going to create a new framework", happened with the time) . I Know it's a bad bad bad practice and "wheel reinvention" move, BUT, I now develop my projects much faster (more than PHP only).
Since it's code is a total MESS, I started about one month ago to reformulating my framework, now it uses composer, follows common rules that exists between the php frameworks, is MVC.
Why I'm reformulating ? Because if someone needs to repair a project of mine it will not be a another world thing.
So I Understand you.
My Advice is, prepare your tools (call it a framework, a preset-app or whatever people names it), and use it the way you feel better, but still follow some common rules (Like MVC, "easy to module" things wich you can replace in case of broken.
For basic security, I use a custom filter method that wraps up my superglobals. Its syntax needs some getting used to, but is simpler than the PHP filter_var() API and doesn't let you slip sanitization:
$_GET->text("inputvar") or $_POST->name["field"]
It also allowed inline $_REQUEST->sql() escaping. But for database work keep using parameterized SQL, or your DAL/ORM of choice.
I did a one day study of ToroPHP and found it quite nice. It is a minimalist framework targetted to RESTful applications. This makes it possible to keep the server side code modular, without having to deal with bloat of any framework.
I don't know what is troubling you but codeigniter is a great framework.It has nice documentation and since lots of people use codeigniter you will find all the help in its documentation,or forum or on stackoverflow.I have worked on many frameworks (Codeigniter,CakePHP,Zend,Spring 3.0, Ruby on Rails),but I must say codeigniter has the best documentation.There are lot of things in codeigiter which are automatically handled and you don't have to worry about security.
Working on core PHP is like re-inventing the wheel. Well the most important thing is that moving from a core to framework will need lots of your effort once you are used to it, you will start loving it.Also Ruby on rails is also a great framework once you know its ins and outs you can have double speed.

Choosing between PHP frameworks and template systems [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 have a moderately simple assignment, to create a PHP/PDO site with login functionality and article retrieve/save/edit/search. No tags, nothing else.
Is this overkill to use some framework for this?
It it a good decision to use custom code + perhaps template system like Smarty for a simple site that will not grow too much?
Is there a software niche/best practices for small sites?
In a nutshell, I need logins/forms, but aren't frameworks like Zend or Cake too much for this?
I think that you can never go wrong by adding a framework to any size project. Anytime you can reuse something (and not reinvent the wheel) or leverage an existing code base to speed application development time, then do it.
Besides, you never know when your small to mid-size project suddenly grows to a large project. At least then you will have the pieces in place to grow your application and not have to start from scratch.
I'm a big fan of CodeIgniter, it would make setting up a simple website like this pretty painless. There is a fairly extensive stackoverflow answer about authentication libraries for CodeIgniter which would make login a breeze.
I would not suggest using a third party template library such as smarty. CodeIgniter has helper functions which can be used within 'views' which will allow you to do a lot of things quickly and painlessly, such as form creation.
I think using a framework is ideal for simple projects. They're quicker to set up and get going with. A framework may not be ideal if you need to fine tune how the site will run for reasons such as scalability or special requirements, or because you just don't like frameworks.
I'd suggest just using whatever parts of the Zend Framework you feel you need. Zend is very 'pick and choose' friendly.
That said, I recently used the ZF Application (MVC collection) for a two page site, just because it made things so easy. You don't need to have multiple controllers/models/view helpers to justify using a MVC framework.
Please don't user smarty. It's really unnecessary. PHP is it's own template language.
These posts on sitepoint tell the story well: #1, #2, #3
I've been using Kohana and I like it.
http://www.kohanaphp.com/
This guide got me started Kohana 101
For something that simple you can use a tiny framework like MicroMVC which comes with a equally small PDO based ActiveRecord-like database class.

Categories