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 am a core PHP developer and learning MVC Frameworks: CodeIgnitor and Kohona. I downloaded few sample projects to do research on how they work. I am really confused how to determine which Model, which View and which Controller are interrelated to each other.
How can I easily locate which View is for with Controller and vice versa for models, views and controllers.
Also, can anyone tell me what's the major advantage of using these frameworks (Sorry this question to be asked in Google first, I am just looking for short answer) and I feel frameworks uncomfortable cause its hard to locate right file if someone else developed the application.
The right way to find related files in a project is that, you have to read code, for example, if you want to find what view or model is being used in a controller then you should seek in the ode, which model it calls and which view it loads. This is the only way to find related files.
There are lots of advantages to use a framework but one of the most important advantages of using a framework is that, it speeds up development process, writer less do more, it makes your development process faster because it provides you some tools, for example, a Session class for session management, a Validation class for user input validation etc, using these tools you can easily make an application with a very few code and it saves your time so you become more productive.
Another important advantage is that, if you are working in a team and use a framework then each developer knows the code organization of the project because the framework ties everyone to a single set of rules that every developer must follow, everyone follows the same conventions so there is no confusions and any time you may add more developer to work on a project who knows the same framework and can work without any problem.
CodeIgniter and Kohana does not implement MVC (even if they say so...).
A typical flow in php frameworks that call themself MVC are : A url routes to a controller, the controller retrives data from model and passes it the view.
The advantage to using a framework should be that it provides a set of tools for rapidly development, making you focus on the unique code for your application.
The documentation for each framework should be pretty straight forward, you should read it if you going to use a framework...
Related
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 6 years ago.
Improve this question
Should I:
A. make this medium to possibly huge website with PHP first and then
implement Laravel
or
B. Learn Laravel now and build the site with Laravel from the get go?
About the site I want to make:
Scalable - it can handle 200 or 200,000 users using the site at the
same time.
It will mostly run on text entries, calendar functions, lists, some
social networking within and outside the site
I want the customer to not experience lag.
I will most likely be the only person working on the coding.
Each user will not be able to upload pictures or videos at the
beginning of the project, but I would like to allow it as the site
grows to maybe 15-30MB/user.
Credit card processing or Paypal will be used as a recurring charge.
I'd like to start small and grow with the customer base
Due to cash flow Cash flow I'd like to use the least amount of $ possible in the beginning
I may pass it off to someone else in the future if it gets too big
too fast
About me:
After a lot of research it looks like Laravel is the PHP MVC
framework that will stand the test of time (5 years~ hopefully)
First time asking a question - this site has helped me so much over
the years!
Just learning PHP, Javascript, SASS, MySQL, etc, because I have an
idea and no money to hire someone else.
I do enjoy creating things though and have enjoyed HTML, CSS, and VBA
in the past.
If you in near future wanna implement the site with laravel I think you should do it now even if it delays you for 1/2 week to understand laravel clearly. Because as days go by your codebase grows larger and you'll neither have time nor will to convert it rather than adding new features :)
Jump right into Laravel if you are new to PHP
Install the Homestead virtual machine
Follow the entire Laravel From Scratch series
Do the Basic Task List app
Then explore some more of Laracasts and go from there.
Bonus:
Get PhpStorm
Use git version control
Get a GitHub account and store your code in a private repo ($7/mo)
Definitely start with Laravel. It will significantly improve your development time and make your code more maintainable. This is specially true if you are just starting with PHP.
Learning PHP first is also good, but if you are trying to create an application also i'd suggest learning Laravel First, this would improve your overall knowledge about how MVC frameworks work, and laravel's awesome features.
To learn laravel, check out this link: https://laracasts.com/series/laravel-5-fundamentals
Even if you want to use Laravel sound knowledge of PHP is a must. Laravel is based on MVC(Model View Controller) model. So it wont be that much difficult to handle as there are several tutorials on MVC. You get the PHP OOPS fundamentals and then jump to Laravel.
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
since about two years ago, I did find my interest in code (Hardware/Sytems/Web) and now, I've found a project which motivates me a lot (It takes all my free time indeed).
Starting this point and because my project could soon switch from a free time project to a daily job, I'm currently developing a mockup of this project based on PHP/MySQL and JQuery.
Even if I'm a true Python/MongoDB lover and a System Engineer, I did prefer those technologies to build up my mockup because of their simplicity to build a complete functional private stack at home.
I'm pretty advanced on my mockup and it seems to work as I want it.
Now I'm wondering if, about your point of view, would have been better to start to build my mockup using directly the targeted technologies (Python/MongoDB) rather than to use the easy PHP/MySQL couple to do it?
Obviously, because I plan to made this project my daily job, I had to have something visually functionnal to be able to raise a little bit of money, and about me, using an easier stack it's more easy, but I would like to have your feedback on this kind of question.
The idea that PHP/MySQL is easier or simpler than say Python/MongoDB is just inconsistent.
If you compare for example, Django (the most popular python web framework) with symfony(PHP) you will find that they are almost identical in terms of features and architecture (symfony is actually slightly more complex but also has more very advanced features).
For mockups, if I were you, I would use solely HTML/jQuery/CSS.
Build your pages just like you would like to have them in your beta version, use jQuery to load sample data written in json.
That's all you need. You can even find WYSIWYG application to speed up the process.
Later on, you can build the back-end application using either python or php, it won't matter.
The integration process will be identical, create your models, create the controllers, and use the HTML you already have as templates.
Building your app in php/mysql then convert it to python/mangodb will make you rewrite almost all the code simply because python is so much different from php (easier I would say too, but that's just my opinion) and because mangodb is not a relational database meaning you will have also to rethink partially your architecture.
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
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
Many frameworks are based on mvc, but I have no idea about MVC. So what is the use of MVC?
Is it for speed, security or any other reason?
MVC allows you to separate your business logic from your presentation layer. This "Separation of Concerns" allows you to quickly find and edit portions of your code. It also enables easy reuse of your UI components across your system.
Check out the wiki page for a overly academic and technical introduction to MVC http://en.wikipedia.org/wiki/Model_view_controller
MVC is mostly for better maintainability of your code. By separating the database logic from the presentational logic from the controller logic you can make changes/rewrites/maintence more easily.
it also solves the problem of "spaghetti code", you can outsorce your HTML/XML/PDF/XSL creation Code to your View/Template engine, get the Data from Your Model(DB/File/RemoteCall,...) and your Controller controls the behaviour of Both, you can also simply exchange the View/Models without even Change the Controller if u implement it right, so you gain Seperation of Concerncs, get better Code & Maintainability and can easily swap components
also its easier to manage if your projects grow. I recommend the Usage of a FrontController which selects the right Controller for you depending on the Users input, you can also use Inversion of Control/DependencyInjection Pattern there and let your Controller be configued by your FrontController / Pass DB Connection and lots of lots of lots more funny stuff
Now u got a simple application framwork:) Use Zend Instead:)
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.