- Introduction of Laravel
I was looking for structured way to develop PHP web-application since i moved from java to php.Because developing an application in core php is fine at beginner level, or at learning stage. But if you are developing medium to large size application, it is quite difficult to maintain a coading standard and architecture of the application between developer to developer. Also consider the case the way usually we write code in core php:
$some_var= “some value”;
Some operation on $some_var
Looking at above code if you have to debug or have error in the page you have to debug trace from beginning of the page, which is difficult for problem isolation.You can not easily identify which portion of the code goes wrong.Also maintaining the code is difficult when using inline variables inside the samd page.It is okay fir small application but for a medium to large scale application you have to do it better structured way, you have to do better architecture.So for this there are two ways,
- Either you prepare your own architecture using all the oop concepts,
- You will use existing available framework having all the hooks readily available like
- database management
- Customized routing for SEO
- Request filter
- REST support
- Caching ang logging
Also you will integrate you own business logic inside that framework.
If i have to go i will choose second option, as i have all the wheels available and tested.
Now decision is made that i will go ahead with readily available architecture that provides all the above mentioned facilities. I have started looking for a mvc frameworks available , i found not a couple if them but there are huge list.
Now again it is a question which frameworks best suited for you? There are no simple answers for this question as it depends on lots of parameters. But anyways most of the frameworks provides some common functionality which is required for a complete web- application. After searching i compere a frameworks side by side and analyze which frameworks provides most of facility needed for a web-app. Also there are couple of factors i see like,
- Learning curve
- Community support
- Plugins / extension.
There are lots of MVC frameworks available in PHP but, i found two frameworks which satisfied above points and they are Laravel and Yii. Both provides similar facilities. But i found laravel more convenient to me based one below points.
- Nice, short and to the point Documentation with very simple language .
- Easy configuration using simple PHP array.
- Internationalization support.
- Easy to customize and not opinionated.
- Awesome Sentry package for Users, Roles and Permission management from Cartalyst.
- Customized route generation so that initial SEO support can be added.
- Awesome Eloquent feature, so model attributes and getter,setter not required
- Very powerful blade template engine.
- Easy to add REST support.
- Master page concept like ASP.NET using blade template engine layout.
- Awesome package management using Composer.
Laravel is the mvc framework for developing web-application in php. Here in this course i will not cover the features and starting from scratch. But i will highlight some bullet points on which a beginner developer can focus if he already know MVC design pattern.
- Directory Structure
- Model, View and Controller
- Blade Template engine
- Database Interaction
- Security and Filters
You can expect more on laravel app directory structure in my next article.
– Ahesanali Suthar