Getting started with PHP / MVC [closed] - php

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 6 years ago.
Improve this question
i have been using PHP for quite a sometime now, having understood the concept of OOPS, PDO, etc. i have been slowly moving forward to more advanced PHP. my strategy is always to learn more and more advance programming in every project. for my current project i would like to implement MVC, as i have been implementing my own directory or application structure before, this time i want to use MVC for my application. i did went through a MVC boilerplate tutorial on Nettuts. however that was just the basic i am searching for more and more resources for me to help get started with MVC for my projects. i am sure you guys might have passed from the same path i would like to know the links and suggestion about some of the great MVC tutorial for PHP available in the internet.
EDIT :
I have used frameworks like cakephp before i would request not to suggest using of any framework.
thank you

I would suggest you look at the MVC Design Pattern so that you understand it before you start using it.
Ideally, you should already have made some projects where you suffered a little bit because you wanted to change stuff when your project was at least halfway done.(This is one of the main motivators behind a lot of so-called advanced programming techniques. Ease of modification, flexibility and so on).
This is where stuff like what you mentioned (OO,MVC, and I would add TDD, Design Patterns) all come in).
What I do for myself and suggest others do is the following. Look into whatever you want, be it TDD, MVC or any other advanced technique. But wait until you need them.
In my personal opinion, one can much better appreciate the value of OO and MVC when one has gone through a naïve project and suffered from lack of functionality these techniques provide...
The golden rule is.. only start using a new technique when you've understood it and seen what benefits it can bring.
I say that because what I see in real life is that many people use stuff like OO, MVC and even Design Patterns without understanding the why's behind. I don't think that helps at all.
Good luck.

I strongly suggest you to take a look into Kohana framework. Its an HMVC framework, with cascading directory structure. If you are looking for books on advanced topics, "PHP Objects,
Patterns, and Practice" by Matt Zandstra describes very well about Design patterns in PHP. "Pro PHP Patterns, Frameworks, Testing and More" is also an excellent book which discuss about many advanced topics.

That tutorial discusses implementing one's own MVC framework. You can use an existing framework to implement applications using the MVC paradigm. I happen to prefer Zend for this. Here is a tutorial on using Zend MVC Framework:
http://framework.zend.com/manual/en/learning.quickstart.intro.html

You can try to start with Yii it easy to lear and use:
http://www.yiiframework.com/tour/

To get my mind around the concept, I found a lot of reading to be helpful as well as seeing it implemented from scratch. Several resources:
Book Resource: PHP In Action, pages on MVC. (Great because mentions the difference between application and web MVC).
Understanding the Concept: http://www.cs.cmu.edu/~pattis/15-1XX/15-200/lectures/modelinmvc/
Build Your Own Tutorial: http://net.tutsplus.com/tutorials/php/create-your-first-tiny-mvc-boilerplate-with-php/
Build Your Own Tutorial, more complex: http://www.nathandavison.com/posts/view/11/custom-php-mvc-tutorial-part-1-introduction

Related

Benefits of using cakePHP? [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 know PHP well. But i haven't tried cakePHP before and i was willing to learn cakePHP. So just want to know that is there any benefits of using cakePHP over PHP?
Thanks,
aby
cakePHP, like CodeIgniter, FuelPHP and Symfony (just to name a few) are frameworks. What this means is that they have tried to abstract some of the normal, every-day things you do in development in an effort to speed up development time and make you more profitable.
In today's world, there is no excuse for not using a framework. If you refuse to use a framework, you find yourself creating a lot of the things that a good framework provides anyway (i.e. data abstraction layers, session classes, form validation, etc). By using a framework, you not only gain time, but you gain stability as the different components of the framework should be designed to work well together and have been thoroughly tested by the community.
Whichever framework you choose is up to you and hopefully now you understand it's benefits.
CakePHP is an MVC framework that will allow you to setup your data model and connect it to a database to be easily manipulated in PHP. It also allows you separate your business logic from your display logic using a controller.
It also gives you a lot of useful functionality like authorization, sessions, form validation, pagination.. for free. You should check out the feature list.
If you didn't use CakePHP you would have to roll your own framework, which is a lot of extra hassle and work. There are of course other frameworks.
The answer is pretty simple, it comes down to your need's, do you need a framework?
You say that you know php well, i doubt you know it as well as you think as you would not ask a question of this nature, you would understand the concepts behind a framework.
You say:
So just want to know that is there any benefits of using cakePHP over PHP?
it's not a language sir, it's a framework that supplies the PHP foundations for an application, why would you not wan't to use such a thing, what you should be asking is:
What's the best framework to learn once you have mastered PHP Fundamentals.
But don't ask it here, there are plenty of posts that answer that question for you.
CakePHP is an MVC framework But to simply say you need to design the data models and relationship (creating necessary tables) before start the work , once you use bake command 70% of coding are given

Is there a thin framework in PHP I can use? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I'm looking for a thin web framework in PHP5 to start my project. I have come across some popular frameworks like Symhony, Zend, CodeIgniter... but they seem too complicated and their source code are too long to read. Is there a light framework out there I can use?
(I know some OOP, MVC in PHP)
Thanks for your help.
I would say Codeigniter is about as light as you are going to get, It's fairly convention-less and has proven to be the lightest in terms of overhead.
It is simple and well documented.
My choice of vote is for CODEIGNITER , because easy to use and build applications and rich documentation.
Thanks
MicroMVC for sure.
As advertised:
It offers Model, Library, Controller,
Function, and View management. Plus
other features like URI Routing,
hooks/plugins, file uploads, database
abstraction, captcha creation, and
more! If you are new the
Model/View/Controller world of OOP
All under 150kb!
I too agree with #jondavidjohn. I started with codeigniter and really impressesed with its simple well documented syntax. If you are starting framework for the first time, As for me CodeIgniter is the best choice. Give it a try http://codeigniter.com/user_guide/ ...
I find Cakephp Framework very addicted for me.................u could check it out
I think you're looking for Kohana 3 - http://kohanaframework.org/
The documentation sucks but it's very lightweight, there's a good community (even on SO), it's more simple than Symfony and more powerful than CodeIgniter (the first version of Kohana was based on CodeIgniter)
You can check PHP Frameworks site, where you can fully compare all kinds of PHP frameworks and help you choose the right php framework for your project. They offer PHP Frameworks comparison, top 10 frameworks, reviews, forum, etc.
Thanks for your help guys.
I love CI too. I also googled and found this one. It looks promising, let's see how it works out, will come back to CI if it doesn't work.
Personally, I found success with Kohana 2.3 (the later versions don't work as well IMHO) as it has a very simple MVC structure, it runs fairly quickly, and it is OO. It was based off of CodeIgniter.
However, I would pick a framework and stick with it, paying more attention to designing your application with a good understanding of MVC. Head First Design Patterns (http://www.amazon.com/First-Design-Patterns-Elisabeth-Freeman/dp/0596007124) helped me understand why MVC was useful and how to implement it. Good luck!

After learning the basics of PHP, which framework (if any) should I learn? [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've heard of frameworks like Ruby and CakePHP. Should I proceed to learn them, now that I've learned the basics of PHP?
If so, which ones are preferred among PHP developers?
You'd probably first want to find a project you wish to work on. Whether it is a personal or a community project, find out what interests you and begin to build it.
Once you've decided on a project, you can pick a framework that you want to work with, and you'll learn it much more effectively than you would ever learn it almost any other way.
You can look at this question to find out some frameworks that other developers enjoy using.
You might also want to look into learning coding theory over simply frameworks. Things like design patterns, object oriented programming, and other practices are very good, and will let your coding span across languages, as they deal with ideas instead of specific code.
You can find a lot of good information on coding theory and best practices simply by going through the top-voted StackOverflow questions. Once you get past all the cartoon posts, you can see some topics that might be interesting to you, such as code smells (you need to know them to avoid them), RSS feeds for programmers, pieces of advice from programmers, and so on.
You can also look at people who are in the same, or a very similar boat as you. The self-improvement tag is filled with questions of people are looking for ways to improve themselves. Here are some examples:
What should a self-taught programmer read?
Must see talks/presentations
Tips for becoming a better programmer
Finally, you might want to try answering some questions on StackOverflow. By teaching others, you can often learn a lot about stuff you already thought you knew.
This is coming from experience too. If you look at my list of answers, at this point I've answered around 430 questions, and from those I've gained a great amount of knowledge, as I've had to research each question and make sure I understand the subject before answering.
Furthermore, while answering, you are bound to come onto some interesting questions. All of my favorite questions are ones that I have learned something new from, and right now I'm up to 6 pages.
Learn other environments. Learn C#, learn Java, learn design patterns and OOP. Don't limit yourself to PHP. Frameworks are only helpful in keeping your code clean and doing aspects for you.
There is a very handy site: www.phpframeworks.com which ranks several frameworks based on various features.
Obviously there is no right answer on where you should go next. You could go with learning another Web Development language, like Ruby On Rails; you get more into databases or client-side scripts; you could decide that you want to move beyond web development and more toward traditional software development; you could become a PHP guru and develop your own libraries. Really it depends on what you really feel excited about and strong about with what you already have learned with PHP.
I would check out that site to explore the many different approaches to frameworks. There isn't one perfect one, just ones that are best at meeting certain needs.

What's the best way to learn mvc in PHP? [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 8 years ago.
Improve this question
I'm totally new to mvc,how to pick it up?
Go this way:
Read about MVC (Google it, see the wikipedia article)
Choose a Framework (I suggest CodeIgniter - Has a great user guide)
Then go through the user guide and try the things.
The video tutorials are also good, check nettuts.com for CI.
Go this way:
Know what is MVC
Why it is useful
How does it work
Where it should be used optimally
How do frameworks use it (if possible to know)
Learn how frameworks implement it (try using a framework)
Learn a framework so that you can become habituated to using MVC
I know I might sound foolish, but this way can be of great help to newcomers.
Maintain some project written in spaghetti code (CSS + JS + HTML + PHP + SQL, all in one single file), then think how you would separate all these and you'll discover MVC.
Kidding aside. Read about it what you can, try some framework but don't avoid maintenance projects. It is in these projects that you'll see the benefits of MVC or at least those of separation of concerns.
See also this related question.
You can read all about MVC with a simple google search. However, you won't fully understand the beauty of it until you pick a framework and dive in. I hear great things of CodeIgniter. It was my first framework when getting into MVC.
In the end I chose CakePHP. Why? CodeIgniter, while very simple to get started with, gave me too much freedom for a beginner to MVC. I wanted strict rules and conventions to show me how its supposed to be done rather than what I think MVC should be. Maybe later on down the road I'll come back to CI. Either way you choose, my suggestion is to take a small project you coded, and code it in any of the PHP frameworks out there.
CakePHP's and CodeIgniter's communities are among the most helpful. Join a google group for Cake/CI. Read about what people are trying to do. See what problems people are having and good luck!
First research the MVC pattern and look for tutorials that explain how to implement it. Next, get an MVC framework for PHP and use that since there's no sense trying to reinvent the wheel and roll your own.

Learning PHP and web-programming for intermediate programmers [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I would like to know some good resources (book or website) on learning PHP for those who are already familiar with programming.
Many of the tutorials I've been finding are for people who never programmed before and take way to long to go through to even learn basic language constructs.
The optimal resource would not assume previous web-development background however.
The PHP Manual is what I used, especially with the search box in Firefox. Type in a function name and go. If you haven't already, it's probably worth browsing through while you wait for more answers.
Learning raw PHP is probably the wrong way to go if you're already an experienced programmer. I'd recommend picking up one of the frameworks, such as PHP Cake, Code Ignitor or Symfony. These frameworks attempt to enforce the set of best-practices that have developed for PHP developers over the past six or seven years.
To that end, Symfony has a great, "24 hours" style tutorial that can get you up and running with their framework, which will sneakily expose you to writing PHP code. Even if you decide you don't like symfony, concepts such as MVC, routing, templating, ORM, etc. will be covered. The other frameworks have similar tutorials, but I like the 24, one hour lessons approach.
For questions on specific PHP core functions/classes, php.net serves as a good resource (although the document of some of the core helper classes like XMLReader and the Reflection hierarchy can be sparse).
This site has some good stuff:
http://tizag.com
Whenever I am teaching anybody stuff I tell them to just Google "php [insert what you want to do]" and it will usually be in the first few results.
Another option:
http://php.net
Use http://www.w3schools.com. They've got a great tutorial for beginning and intermediate php programmers. Also, the PHP Manual is fantastic.
I definitely use the official site at php.net and O'Reilly's PHP Cookbook most often.
As well, the zend development zone, http://devzone.zend.com/public/view and
Manning's PHP in Action book are useful resources.
It's a bit old now, but I had a great learning experience with The PHP Anthology. If you check it out, please remember that it was published about 5 years ago.
A quick 'net search reveals there's a new one on the market as well, but I don't have experience with it.
Some free PHP5 e-books.
Practical PHP Programming
PHP 5 Objects, Patterns, and Practice
sounds nice
I strongly agree with #stalepretzel -- the w3schools and php.net sites are both incredibly rich resources for both getting you started and keeping you going.
For video tutorials (screencasts), you really can't beat "In the Woods - Diving into PHP" -- The first video is here: http://blog.themeforest.net/screencasts/diving-into-php-video-series/
Handy dandy quick ref here: http://www.addedbytes.com/cheat-sheets/php-cheat-sheet/
When/if you get stuck on a specific problem you can always come back here to SO.
Nicholas
What is your opinion about w3schools ? I recommend this website. This is suitable for beginners and advanced level too.
Also i would like to refer official PHP website and You Tube(Search Video related to PHP)

Categories