It seems like you are using an ad blocker. To enhance your experience and support our website, please consider:

  1. Signing in to disable ads on our site. Our users don't see ads
  2. Or, Sign up if you don't have an account yet
  3. Or, disable your adblocker by doing this:
    • Click on the adblocker icon in your browser's toolbar.
    • Select "Pause on this site" or a similar option for lancecourse.com.

Laravel for Tortoises - part 1: What is a php framework?

By zooboole

Late comers are also comers.

If you are new in php development you might have been perceiving some rumors concerning frameworks and you may be wondering what exactly they are and how you can also benefit from them. Or maybe your are a PHP veteran but you have been hesitating for so long to step into a professional framework.

I just want you to know that it is not late. In this series of tutorial on PHP frameworks, particularly laravel, I have intended to help you take control over them in the easiest way.

In this first part of the series, you will discover or rediscover what a PHP framework is. Mastering this first part will be a very big advantage in understanding Laravel framework.

What is a framework ?

A framework is a tool box for developers. It contains commonly used libraries and all-made functions. It also provides a basic mechanism that makes up any type of application.

A framework provides a basic structure of code that helps easily skip tedious steps in any development process such as: the structure of folders, communications with database, data inputs and outputs, choice of programming design pattern, etc.

The simplicity or the complexity of a framework depends on its type and the philosophy its creators have behind it.

In reality, when you create applications or websites you usually have to set up a folder structure, decide either you are going for OOP or procedural development. Create files, one by one, or you create them where needed. You set up you database connections, locally and remotely. You create you style sheets to design you applications. So on and so forth.

In time, from one project to another you have to go through the same process or if your are smart you will just have to copy one existing structure you used on an old project and re-use it on your new projects.

So, at the end you will have a model of project that you can easily use to jump-start any project. That model is called a framework.

Many developers have in time developed their own frameworks that they understand better and master very well; which helps them to work faster. An example is my pinkPHP. A personal MVC framework I first used to create lancecourse.com.

The issue with this habit is that the framework could have a lot of lacuna and code errors that you alone can hardly notice. It could ruffly take very long to find all mistakes, errors, bad practices, etc. So, it usually makes personal frameworks very weak and risky.

Professional frameworks, like laravel, are framework developed by many people who are usually gurus in PHP and it\'s maintained constantly by elite developers all around the world. The framework is tested thousands of times in all aspects: security, quality,robust, etc.

The choice should be obvious from here if you are intending to develop a serious application that cares about security and power. If you know you are just developing an application for a personal use and you don\'t care about all these problems that could occur, no problem just go ahead.

That doesn\'t mean that personal frameworks are literally bad. I don\'t support that idea at 100%. I had no BIG issue with pinkPHP.

Advantages of a framework

There are several advantages one could enjoy in frameworks such as:

  • Secured and maintained code
  • Usage of clean code
  • Benefit from a good design pattern
  • Rocket start any project
  • The cost: frameworks are mostly free
  • Efficiency: You can save a lot of time
  • Support

As far as I am concerned, one of the must important advantages of a framework is that it represents a master piece of a programming languages. It makes codes standard and harmonizes the development language between developers. Many developers from any point of the globe can easily collaborate on the same source code without having to ask the meaning of this and that. That makes it becomes a mega-function in a programming language. So, the same way every php developer knows what echo() function is, it\'s the same a framework is for those who know it.

Disadvantages of a framework

errare humanum est

  • We can\'t say there is no side effects of using a framework. Even though I mentioned the harmony it brings in the development atmosphere, today there are many framework out there that create a bit of divergence and confusion in practices.

  • Even if you know PHP, you have to dedicate another time to learn how to use a framework. You have to follow the rythm of the framework

  • They are not appropriate for small projects like a personal profile.

  • They can make you loose some native programming habits

  • Code is public. That could be a problem since people with bad intentions can also master the code

  • Framework hide the native layer of the programming language

  • The limitations of the framework are also yours

Yes, there are disadvantages. But I don\'t see anyone that prevents us from using a framework. After all the advantages give us more vim to go for it and that\'s is what we will do here.

List of popular PHP frameworks

As I mentioned it above, there several PHP frameworks in the market. The following are the most common and maybe the most used:

Why choose Laravel ?

Laravel PHP Framework is built on top of Symfony components. That provids a solid foundation of well-tested and reliable code.

It\'s built with the focus of writing code syntax that is simple and expressive. This will provide the advantage of having a Web Application that is developed friendly and with a code that is maintainable.

Although Laravel Framework is only three years old, it has been built with a focus of being superior over the other PHP frameworks, with better code foundation, maintainability and more robust features.

Laravel PHP Framework offers a lot features such as:

  • RESTful Routing
  • MVC, HMVC
  • The Eloquent ORM
  • Bundles
  • Application Logic
  • Migrations
  • Unit Testing
  • Beautiful Templating
  • ACI
  • Authentication
  • Hooks / Events
  • Scaffolding
  • Caching
  • Automatic Pagination
  • Validation
  • Admin Generation
  • etc

All these features may sound weird to you now, but very soon it will become obvious and fun.

Conclusion

That was an introduction on this series on Laravel PHP framework. This part aims at helping you discover or rediscover what a framework is and why one should use them for a more efficient workflow.

In the next part we will discover what exactly Laravel PHP framework is and how we can start using it. Stay around.

Last updated 2024-01-11 UTC