top of page
  • Writer's pictureMartin Nedelkoski

PHP without framework?


PHP without framework cover
PHP without framework

There are many tools and libraries in the PHP ecosystem that we can use when developing an application. Some of them are grouped in frameworks which provide us some preconfigured structure. But with such variety of tools, we can easily make our own structure according to our needs.


Can I Use Popular Framework Features in PHP Without a Framework?


If you’ve been wondering about this question, the answer is YES!


In this article we’ll take a look and list some popular libraries for the different technical needs of our applications, such as talking to the database, routing, providing output to the web and etc.


But first, let’s get back to basics and explain what a framework is.


According to the general definition:


Framework is a universal, reusable software platform to develop software applications, products and solutions. To simplify, it is kind of library, piece of software which provides web developers with code base and consistent, standardized ways of creating web applications.


Your project will have to choose from tons of PHP libraries, frameworks and components. In addition, there are many PHP libraries, frameworks and components to adopt from. And these are called project dependencies like Composer and PEAR. Until recently PHP didn’t find acceptable way to manage these project dependencies. Some of the dependencies explained below show how can you use PHP without frameworks.


Composer repositories like Composer, PEAR, VSC


A dependency manager which installs packages locally with package description and name and version. In basics, package is just a directory containing something. In this case, it is a PHP code, but in theory it could be anything.


Repository is a package source. Practically it is a list of packages/versions. The composer will search in all your repositories to find the packages your project requires.


Databases like MySQL, PostgreSQL, NoSQL


There will be times when your PHP code will use database to persist information and there are few options to connect and interact with your database.


Object-relational mapping (ORM) like Doctrine, Readbean, Eloquent


The ORM manages the translation of object into relational databases and vice-versa. This creates so-called “virtual object database” which can be used from within the programming language.


Templating like Twig, Blade, Mustache, Plain PHP Templates


Templates provide convenient way of separating the controller and domain logic from your presentation logic. They typically contain the HTML of the application, but may be also used for other formats such as XML. Templates are often referred to as “views” which make up part of the second component of the model-view-controller (MVC) software architecture pattern.


HTTP like Guzzle, Buzz, HTTPFul, Requests


This is protocol destined for sending documents back and forth over the World Wide Web. A protocol is a set of rules that is used to identify which messages can be transferred and which are suitable answers to other queries.


Mailers like PHPMailer, SwiftMailer, Stampie


Mailers are libraries used in order to give the application an ability to send mails.


File Systems like Gaufrette, Flysystem, CSV


Libraries for file manipulation and MIME (Multipurpose Internet Mail Extensions) type detection.


Testing like PHP Spec, PHP Unit


Writing automated tests for your PHP code is considered to be a best practice and can lead to well-build applications. Automated tests are a great tool for making sure your application does not break when you are making changes or adding new functionality and should not be ignored.



PHP Code
PHP Code


However some of the dependencies will not be used by your application and may not be essential, therefore you can easily create your own PHP project containing custom dependencies that are most suitable for the project.


Conclusion:


To sum up, using framework can bring to faster development as it tries to save your work by make you define an overly complex configuration that has to accommodate every possible use case.


The versatility of PHP allows developers to build robust applications even without the use of a framework. By carefully selecting and integrating various libraries and components, you can tailor your PHP project to meet specific needs, balancing simplicity and functionality. Whether it's managing database interactions, implementing object-relational mapping, or handling HTTP requests, the PHP ecosystem offers a wealth of tools that empower developers to create efficient and scalable applications.


The key is to understand your project's requirements and choose the right dependencies that align with your goals. Remember, while frameworks can speed up development by offering a structured approach, the freedom and flexibility of working with PHP without a framework can lead to more customized and potentially streamlined applications.


Frequently Asked Questions

Can I Use Popular PHP Framework Features Without a Framework?

Yes, you can utilize many features typically found in frameworks by integrating specific PHP libraries and components into your project.

What Are Some Common Libraries Used in PHP Without Framework?

What Are the Benefits of Using PHP Without a Framework?

How Do I Manage Dependencies in PHP Without a Framework?

Is It More Challenging to Use PHP Without a Framework?


Looks interesting? Any note or additional example? Contact us right away!

HIRE TOP TALENTS. FAST!

At FireHire.ai,

We deliver senior vetted devs to your startup, saving you time and the hassle of finding the right candidate for the job.

Starting from

$45/h

bottom of page