Frameworks

You will accede with me that architecture a circuitous web appliance from blemish is a actual time-consuming action and requires a lot of development effort.

As a result, there was a charge for a simple and structured way of developing web applications that can be adopted by all web developers. That is how frameworks came into existence.

PHP is the best accepted server-side scripting accent for architecture modern, able-bodied and adult web applications. Its acceptance has apparent a lot of high-end PHP frameworks to be developed over time to abridge the all-embracing web development process.

PHP frameworks acquiesce you to body your appliance from templates that contains all-encompassing apparatus and cogent your time in developing specific tasks and functionalities according to your appliance requirements.

Why you charge to use a PHP framework
  • Rapid development while authoritative use of already accurate and alive practices.
  • Follow the Archetypal Appearance Ambassador that allows you to abstracted argumentation from presentation.
  • Organize your cipher in a accepted anatomy arch to reusable and arguable code.
  • Reduce your boilerplate development time by reusing cipher and absorption on your specific task.


Actuality is a account of anxiously researched PHP frameworks that will advice you body circuitous and avant-garde web applications.

Laravel


At the top of our account is Laravel. Laravel is the best accepted PHP development framework as apparent by SitePoint’s online analysis acknowledgment to its all-inclusive ecosystem and all-encompassing online association of developers.

Laravel offers affluent appearance that accomplish that makes the development of accelerated and circuitous applications possible. Its failing Brand templating agent facilitates again tasks such as authentication, sessions, RESTful routing, caching and queueing.

Developers can advance and analysis their appliance locally application the bounded development ambiance alleged Address – packaged Accidental box.

Laravel organizes the cipher for you, so you don’t accept to anguish about alignment it. The chain administration affection manages tasks in the accomplishments and does the action logging for you with the functions actuality run in the environment.

Laravel uses the Artisan to install third-party bales such as the name and anteroom packages.

Apprehensive how to get started with Laravel? Laravel provides all-encompassing affidavit accessible on its website, Laracasts which are screenshots tutorials and Udemy includes video tutorials and abbreviate courses to get you started quickly.

Pros
  • Files and cipher are able-bodied organized
  • Uses MVC architecture
  • Extensive documentation
  • Rich functionality
  • Supports acquittal integrations, e.g., stripe
  • Overloading capabilities
  • Security and able encryption.
Cons
  • Cannot be deployed on aggregate hosting plans
  • Too abundant database queries

Phalcon


One of the affidavit why you will like Phalcon is its speed, and it is as fast as a falcon. This is because Phalcon was congenital as a C extension, therefore, provides the accomplished akin of achievement access and takes advantage of the acceleration C accent is accepted for.

Phalcon processes HTTP requests charge faster than added frameworks acknowledgment to its lower ability usage.

A affection that allows developers to body systems with lower overheads. To assignment with Phalcon involves extending PHP classes for altered functionalities and you don’t accept to apprentice C language.

Appear in 2012, Phalcon’s affluent appearance including MVC, accepted auto-loader, asset management, security, translation, arrangement engines and anatomy builders, has apparent it be actively acclimated in developing able-bodied and circuitous web apps.

The Phalcon website provides affluent affidavit on how to get started with Phalcon.

Pros
  • Very fast with low ability usage
  • Low overheads
  • Autoloading
  • Well accurate and accessible to use the framework
Cons
  • HHVM not supported
  • Not accessible source
  • Any bugs articular are anchored by Phalcon developers – cat-and-mouse for too long.

CodeIgniter


CodeIgniter is addition ideal framework for circuitous and able-bodied web applications development. It is a failing framework that provides a aboveboard accession action that involves uploading a baby brand of the appliance with basal agreement to your hosting server.

With no added commands or software accession required, alone uploading the files, you are set to go.

CodeIgniter formed able-bodied on both aggregate and committed hosting platforms to abstain conflicts in PHP versions.

Addition different affection about CodeIgniter is that it is not a carefully based on the MVC architectonics in that you charge use Controllers but Models and Angle are optional. It additionally gives developers the abandon to apparatus their coding and allotment conventions.

CodeIgniter provides a simple interface and analytic anatomy to admission its sets of libraries for implementing again tasks including assemblage testing, anatomy validation, email, and sessions.

CodeIgniter requires alone a set of few baby libraries to run while added libraries are dynamically loaded back user’s processes appeal them. This makes it awfully fast.

Accepting started with CodeIgniter is appealing accessible acknowledgment to its all-encompassing affidavit and a all-inclusive association of developers who are accommodating to advice at any time.

Pros
  • Easy to apprentice and use for newbies
  • No appropriate dependencies needed
  • Works on aggregate and committed hosting
  • Performs bigger than added non-MVC frameworks
  • Long-term abutment and affluent documentation
Cons
  • Comes with a few built-in libraries
  • Unit testing requires aerial expertise

Symfony


Symfony is on our account because it’s a actual stable, aerial performance, able-bodied accurate and modular framework for the development of important action web applications. Accepted amidst developers because of its absolute sets of reusable apparatus and codes.

The primary focus of Symfony was stability. Developed by French SensioLabs and its community, Symphony is accustomed to be a absurd framework.

It admiral the Laravel framework we’ve apparent above, and it is the accuracy abaft the Drupal agreeable administration system, BBC, and eZpublish.

Symphony can be acclimated to body high-performance BLOW APIs and absolutely anatomic web apps. Its all-inclusive reusable PHP libraries can be acclimated to apparatus tasks such as authentication, routing, article configuration, anatomy conception and a lot of added tasks.

It provides defended and all-encompassing affidavit and boasts of a all-inclusive PHP developer association that is agreeable and active. You charge not anguish about acquirements Symfony.

Pros
  • Stable
  • Rich affidavit and aliment support
  • Byte caching affection leads to aerial performance
Cons
  • Does not abutment MVC. Abounding companies apparatus MVC web applications
  • Requires a lot of time for learning

YII framework


Fast, defended and aerial performance. That’s how we can call the YII framework in simple terms. YII accouterments the apathetic loading address which makes it faster than added PHP frameworks to accord your appliance addition to the performance.

It is absolutely acquisitive and helps you address apple-pie and analytic cipher after repeating yourself.

YII2 framework, the latest adaptation of YII is chip with jQuery and allows you to use AJAX with its set of AJAX-enabled features.

Addition air-conditioned affair about YII2 is its abutment for theming and skinning to actualize an adorable and automatic web appliance by implementing altered capacity of your choice.

YII will abate your boilerplate development time acknowledgment to its affluent appearance including role-based admission control, testing application CodeCeption, DAO/ActiveRecord, affidavit and absolutely supports MVC.

Application the Composer, you can install altered extensions from their all-inclusive association to bound apparatus specific tasks.

YII has a able cipher architect alleged the Gii tool. Gii makes things easier by breeding controllers, models, and angle with a few clicks. In accession to that, the Gii apparatus will account your absolute CRUD operations code.

Thumbs up YII! The alone altercation you will face is designing your database and canyon it to Gii and acquaintance the absolute ability of Gii. Yii lets you apply your focus on architecture your specific tasks.

Pros
  • Less cipher for the affluent and able-bodied web app
  • Generate cipher with simple clicks application Gii tool
  • Authentication bales and role-based admission ascendancy accouterments high-level aegis to your app
  • Development time is reduced
  • Take advantage of the third-party extension
Cons
  • Does not accommodate congenital allowances
  • Requires you to be organized


Yii offers altered abstracts to get you started alignment from its documentation, accessible API to its online association that gives answers to altered user’s questions.

As a adolescent YII developer these books will accomplish you adept the framework: The Yii Book (2nd edition) by Larry Ullman, Web Appliance Development with YII2 and PHP, Yii2 Appliance Development Cookbook- 3rd copy and Acquirements Yii testing by Matteo Pescarin.

CakePHP


CakePHP, ideal for beginners is a framework that provides an all in one toolkit for creating convenient web applications affluent in functionality with beneath accomplishment required. CakePHP is one of the best adequate PHP frameworks currently.

Cipher bearing and axle capabilities will abate your development time. CakePHP is best ill-fitted for bartering web applications.

Its all-encompassing accumulating of comfortable appearance including SQL bang prevention, cross-site appeal bogus protection, cross-site scripting blockage and anatomy validation makes it a actual defended PHP framework.

It absolutely supports MVC with altered MVC conventions to adviser developers throughout the process.

CakePHP is still beneath development and has actual affluent affidavit and online forums to advice you get started. CakePHP admiral websites of big companies including BMW, Hyundai, and Express.

Pros
  • Easy to apprentice for beginners
  • Fast builds with scaffolding
  • Best ill-fitted for bartering web apps.
  • Vast aegis features
Cons
  • Not ill-fitted for architecture RESTful APIs.

Zend Framework


Architecture action akin web applications? Zend framework is actuality to assist. Zend is a abiding and able-bodied PHP framework that comes with a lot of configurations that makes it an accomplished advantage for architecture circuitous enterprise-level projects.

Zend focusses on security, performance, and extensibility.

Zend has affluent development appearance such as annoyance and drops editor which supports front-end technologies (likes of HTML), database affiliation wizard, burning online debugging PHP assemblage testing accoutrement and cryptographic coding tools.

As a aftereffect of its action apprenticed nature, Zend is not ill-fitted for accelerated app development. Developed application an active alignment which focuses on developing able-bodied and acceptable affection applications to action clients.

However, it comes with air-conditioned appearance to accomplishment developers from abounding hassles: the Zend flat IDE accurately fabricated for Zend framework allows you administer all your files and cipher in one place.

Pros
  • Best for action applications
  • Object-oriented and supports MVC
  • Provides affluent appearance for action appliance development.
Cons
  • Not ill-fitted for accelerated appliance development and baby projects

FuelPHP


FuelPHP was addition adjustable and full-stack PHP framework that was congenital with the Hierarchical-Model-View-Controller (HMVC) architectonics in mind.

The framework is awful modular and adaptable and addresses assorted aegis apropos acknowledgment to its aegis appearance including ascribe and URL clarification and achievement encoding, and on top of this, it comes with its affidavit framework.

Added functionality includes arrangement parsing and able object-relational mapping (ORM) support.

FuelPHP is association apprenticed with lots of abutment forums and abounding documentation. The framework is actively developed with account to accomplish it absolutely object-oriented, adeptness to install it via artisan and able to abutment multi-application with a distinct accession planned for the abutting release.

Pros
  • High modular and provides ORM integration
  • Authentication bales and framework for avant-garde security
  • Plans to accomplish it acquisitive and acquiesce artisan installations.
  • Supports RESTful routing.
Cons
  • FuelPHP is not affable to beginners.
  • The developer association is not as alive and agreeable like others like YII framework

Slim


Cerebration of a PHP framework that will advice you body simple and able web apps and APIs? Well, Abbreviate is actuality for you. Abbreviate is a micro-framework that was aggressive by Ruby’s microframework – Sinatra.

Micro-frameworks are baby as the name advance and minimalistic in design. They are created for the development of abate apps were adopting a full-stack framework would be a cher mistake.

Abbreviate is broadly acclimated by abounding PHP developers to body failing RESTful APIs and services. Abbreviate boasts of a advanced ambit of appearance such as client-side HTTP caching, URL acquisition and cookie encryption.

A abbreviate framework is actively maintained with all-encompassing affidavit for beginners to accomplish the accomplished action actual accessible for everyone.

Pros
  • Get started bound with its affable documentation
  • Ideal for baby APIs
  • The fast RESTful framework currently
  • Security appearance like cookie encryption
Cons
  • No abiding abutment for the anatomy released.

Phpixie


Phpixie is a new PHP framework that was advised for read-only websites. It is lightweight, fast, modular and requires little ability to get started.

The framework adopted the HMVC architectonics and was developed application absolute apparatus – apparatus are assemblage activated and can be acclimated after necessarily application the framework.

Phpixie comes with altered accoutrement for aegis including cryptography, ascribe validation, affidavit and allotment and added appearance like caching, ORM and abutment for MongoDB.

Acquirements Phpixie is actual easy; its official website will accomplish you a Phpixie pro aural 30 minutes, with a lot of applied use cases acknowledgment to its blog.

Pros
  • Get started bound with its web tutorial.
  • Documentation with examples
  • Compiles faster
Cons
  • Not actual popular
  • Provide few modules

Fat-Free


Flat-Free is a awful modular and failing PHP micro-framework that is affluent in appearance and bales authoritative it accede some functionalities of full-fledged PHP framework like CodeIgniter.

Flat-Free is advancing with bags of bales for angel processing, assemblage testing, abstracts validation, Accessible ID and a lot more. It weighs almost 50KB to accomplish it actual failing PHP framework.

The framework offers abutment for SQL and NoSQL databases and makes the accomplished action of developing web apps a aboveboard adventure. It additionally consists of several plugins, object-relational mapping, and queueing mechanisms.

Pros
  • It is a failing PHP framework
  • Perfectly ill-fitted for multilingual apps
  • Provides off the shelf abutment for databases
  • A lot of bales for a array of functionalities
Cons
  • Offers no different options analyze to added PHP frameworks
  • No MVC

Aura


Ambience framework is an accessible antecedent PHP framework that consists of well-tested, standards-compliant set of decoupled libraries for PHP that can be acclimated to advance simple yet able all-important applications.

The libraries are absolute and independent acceptation they can be chip into any activity separately.

As a result, Ambience gives PHP developers the adaptability to accept which libraries to accommodate in their applications. With affidavit for every library package, this can able-bodied be a starting point for beginners.

Pros
  • Lightweight
  • Documentation to bound get you started.
  • Active developer community
  • Can be acclimated for developing baby BLOW APIs
Cons
  • Still new in the market. Has a lot to do to bolt up.

These PHP development assets will jumpstart your carrier in web appliance development



  • 1. Udemy course: from abecedarian to advance. Apprentice the best php practices with this anterior advance to PHP.
  • 2. Acquirements PHP 7 by Antonio Lopez: absolute your abilities from simple to circuitous web applications application this PHP 7 book.
  • 3. PHP 7 Simplified: from simple to advance. Apprentice how to body able-bodied web applications with affluent use cases and examples.

Conclusion


These are the best PHP frameworks available, and you can accept to advance your web applications. As depicted, the frameworks can be classified into sets of micro frameworks, fully-fledged frameworks, akin of security, those acceptable for action web applications or baby web apps and APIs. Anniversary framework will accept all-encompassing functionality and different appearance to its name to accomplish it angle out from the others. As a developer, it is your job to accept what the strengths and weaknesses of anniversary framework are and adjudge on one that will accommodated your appliance requirements and fits your accomplishment set.
Authoritative the accommodation will blow on abounding factors including affluence of use, affidavit and support, scalability issues, acceleration your hosting environment. Let’s appearance the web by developing high-end web applications application these PHP frameworks and advice advance our businesses to the abutting level.hj

POST and GET

Now, let’s get to the capital acumen you appetite to apprentice a server scripting language. You appetite to apprentice how to booty user ascribe and do article with it right? PHP POST, GET, and REQUEST are the primary means to booty ascribe from the user. You can use these variables to associate with anatomy aspect abstracts or strings in the url. Already PHP receives that input, you can alarm these variables to get their ethics to action the input. But first, we should alpha with how forms work. Appointment a anatomy is absolutely easy, so let’s get to it.

Example

Aftermost Name: Aboriginal Name:

That is a actual abridged adaptation of how to handle forms. We accept to argument fields: one for userLastName and one for userFirstName. Back we abide a form, those ascribe names we accelerate a appeal to the browser that has a appeal string, a column appeal in our case, with anniversary ascribe name and their value. Afterwards we abide the form, PHP can now admission that cord with $_POST, which is an arrangement of variables with key ethics actuality those ascribe names. If we appetite a accurate variable, we can aloof alarm $_POST[‘userLastName’] and that would get us the amount of whatever the user put in that user input. We already formed with arrays, which agency you accept accept how to book out the absolute arrangement application print_r(array). You can do the aforementioned affair with the column amount array. What if we appetite to do article added than spitting out the data?

Example

Access a number:

As you can see back a user types in a cardinal and hits submit, the cardinal is assorted by 7. Or if the user is a astute guy, and types in a addition appearance it allotment “Not a Number!!!” because it wasn’t absolutely a number. Ok, it doesn’t absolutely do that, but I will appearance you how to accomplish it do that in the area beneath about server ancillary validation. In the absurdity administration tutorial, you will apprentice alike bigger means to handle this in a added adapted manner.

Server Ancillary Validation

Never assurance user input. It doesn’t amount what you are aggravating to get from the user. It could be a cord or some number, consistently run some blazon of analysis adjoin it alike it it is aloof blockage if the amount is null. A hacker can actual calmly use the actuality that you don’t accept server ancillary validation in abode adjoin you. They could calmly inject JavaScript cipher (or SQL cipher if we are ambidextrous with databases) into our forms and accept a way to drudge our added users or to ambush them into accomplishing article they don’t appetite to do. Let’s go through an archetype on how to validate the user’s input.

Example

Enter a number:

$_REQUEST Variable

Another capricious that I haven’t mentioned is a catchall variable. The $_REQUEST capricious does not affliction about how the advice was transferred. This is advantageous for situations area you ability accept a GET and a COLUMN for the aforementioned variable. For instance, maybe addition needs to animadversion on a assertive commodity and would get to that folio through a link. But already they access at the animadversion form, they charge to column the comment. So, you would charge a GET capricious for back they arrive, but a COLUMN capricious back they post. However, you should not use the appeal capricious unless it is a bearings agnate to this one. It is aloof bad practice. Apperceive your variables.

References

String Replace

Now we access in the string alter tutorial of PHP. Like I said earlier, we won’t be accoutrement all of the cord functions, mainly because this is added of an anterior tutorial rather than an avant-garde advertence guide. However, if you can accept these few functions, it should be accessible for you to dispense strings application the added functions. The cord alter action is acutely advantageous in managing strings. Let’s action our way through an example.

Example
$myString = "The meerkat association was victorious.";
echo str_replace("meerkat","squirrel",$myString);
Result The accumulate association was victorious.

Wow! We aloof afflicted the aftereffect of the war with a simple PHP cord function. We acquaint PHP to attending for all occurrences of “meerkat” and alter it with “squirrel” in our cord capricious $myString. PHP runs through and does exact matches for anniversary and every instance, which agency if we had the chat “meerkat” in that cord a actor times, PHP would alter it with the chat “squirrel” a actor times. Of course, you can additionally use cord alter as a way to annul characters or words from a cord by authoritative the additional constant “”. PHP would go through and alter the chat with an abandoned string.

Another advantageous agenda actuality is that you can use the cord alter action with arrays to save you time and accomplishment of accepting to apprentice added functions. The cord alter action is cases sensitive, so if you were to chase for “MEERKAT”, you wouldn’t accept afflicted anything. Also, there is absolutely a alternating parameters, which you can put a cardinal in to acquaint PHP the cardinal of characters or words you appetite to replace. If you appetite to dig deeper, you should attending into the preg_replace action that application approved expressions to accomplish the matches, but I approved to accumulate cord backup simple for you. That is it, you are now a adept of PHP’s cord alter function.

String Position

Now, we dive into the apple of strings and all of the crazy functions. Well, not exactly, but we will absolutely dive into a few of the absolutely above cord functions so that you accept an compassionate of how to assignment with strings in PHP. You ability apprehension that PHP has a lot of functions and not methods, which agency you can’t alarm article like string.method for these functions. First, we will alpha off with application the cord position action in PHP. Example, please!

Example
$myString = "The meerkat association was victorious.";
echo strpos($myString, "meerkat",0);
Result 4

The aftereffect you get should be 4, unless I bootless you. Aloft an assay of this code, we see that we accept a cord capricious that has the capacity “The meerkat association was victorious.” We again answer the aftereffect of our strpos function. Our strpos action takes $myString and searches for our abutting parameter, “meerkat”, alpha from our starting basis of 0. If we calculation out the string, T is 0, h is 1, e is 2, the amplitude is 3, and we accept the chat meerkat that starts at a position of 4. Cord position can be acclimated this way, but it is generally acclimated with some added action like back you watch to get a allotment of a cord back application the substr function.

Sometimes, you ability use strpos to accept an accessible way to analysis if article is in a string. While not the best ideal action to use, it does the trick. We apperceive the strpos action allotment the basis of the match, but what happens back it doesn’t acquisition a match? In that case, it allotment -1, so we can actualize an if account that has a codicillary blockage if the strpos action allotment article greater than -1.

I should acknowledgment a few things afore we abutting this tutorial. The strpos action is case-sensitive, which agency if I would accept searched for “MEERKAT”, it accept alternate a abrogating one, which agency it didn’t acquisition a match. Also, the 0 we accept is an alternative parameterthat tells our chase were to activate in the string. So, if we would accept had 10 instead of 0, we wouldn’t accept alternate annihilation either. This is because “meerkat” begins on the basis of 4. You can use this altercation to get sub strings amid assertive words. Abundant with PHP’s cord position. Accompany on the abutting cord function!

strpos vs strrpos

Often, we accept that strpos and strrpos are the same. Well, the do the aforementioned function, but they access it two altered ways. strpos finds the aboriginal accident of the analogous account in the cord and allotment its position in the string. strrpos starts from the end and allotment the position of the aftermost accident in the string.

Comments

We access at the cornerstone of all languages, including PHP, comments. I cannot accent the accent of commenting your code. As a webmaster, I actualize all kinds of web applications, but added importantly, I advance the cipher ahead crafted afore I arrived. So abounding times, I accept wondered “what the heck were they accomplishing here?”…And afterwards about 10-20 account of digesting their code, do I absolutely accept what they were aggravating to accomplish. Amuse comment. Please. With that actuality said, try to not over animadversion either. It is accomplished to do it on every few curve starting out as a beginner. However, back you get added advanced, try to animadversion ample sections (each action and at atomic every 30 lines) and explain what you are accomplishing in the afterward code.

Enough of the lecturing, how do I absolutely comment? Commenting is cool accessible aloof like in added languages. In PHP, you can accomplish comments in two ways.

Comment Out One Line

Example

//echo “I am awesome!”;
#echo “I am awesome!”;
echo “I am absolutely awesome!”;
?>

Result I am absolutely awesome!

Obviously, the // alone comments until semicolon or until the end of the line. It does not crave a closing partner. The # works absolutely the aforementioned way as the antecedent comment. The added blazon of comment, is a block comment, which allows you to animadversion out added than one brainless line. It lets you animadversion out about abundant you want.

The Multiline Comment

Example

/*echo “I am awesome!”;
echo “I am absolutely awesome!”;
*/
echo “I am cool awesome!”;
?>

Result I am cool awesome!

The /* requires the closing tag of */. Aggregate in amid these tags is absolutely abandoned as PHP code. This animadversion is absolute for testing your code, blocking out cipher that is not bare appropriate now, and autograph a branch on what your afterward cipher is declared to do.