As a creative technology team, we at Brand Catalyst Media have always strived to be at the forefront of Web & Mobile technologies. Our focus through the years has been on building bespoke, ground up websites, web applications, content management systems and over the last 3 years, mobile applications. We can be best defined as restless minds, working harder and pushing forward, adapting to changes on the way. Here is how we evolved from what we did best and made it even better.
“The measure of intelligence is the ability to change.”
-- Albert Einstein
This is where the Software Architecture & Platform comes into play. For anyone who has a focus in PHP development, we all can agree that PHP is one of the world’s most popular scripting languages. If I were to talk about PHP and the sheer support it has, this article would be a lot longer. So I'll only talk about how we have leveraged the capabilities of PHP to build quality products.
PHP is undoubtedly a strong language. It plays well with almost every major platform - Windows or Linux or Debian. It binds well with database solutions like MySQL, PgSQL, Sqlite, MsSQL, MongoDB. So essentially, our clients could have multiple combinations of solutions for their products to run smoothly. PHP provides a very strong foundation for any project.
Since inception, our focus and forte was Core PHP. With Core PHP, one developer can code the exact same thing in multiple ways. It only depends on the developer as to how efficient and manageable code he writes is. That being said, we’re huge fans of standardisation and we have always been in front line when it comes to manageable, readable, scalable and secure code. We have written a range of solutions in Core PHP where we hand coded every little aspect of our client's requirements to provide a better and cleaner product.
So, we were providing these great, complex solutions built in Core PHP to our clients. Sounds good right? Well yes and no. Our work has always been exciting but through years of deploying Core PHP solutions which were customised to the T, a lingering feeling of redundancy had started to set in with Core PHP.
We are a bespoke agency that creates custom solutions for our clients. For every project we build, the client owns the IP and rightfully so. The proprietary code which was a part of the IP was almost always directly related to algorithms, complex structures or unique features that we had built for the client. However, a large number of our clients had about 20-30 % common components which weren’t proprietary such as logins, registrations, payment gateway integrations, public API integrations (Facebook, Twitter), image optimisation codes and so on.
When we were coding with Core PHP, it was getting increasingly difficult for us to reuse even basic common components given version differences, compatibility issues and other constraints. This left us feeling that even for basic functionalities, we were reinventing the wheel every time.
With Core PHP, it gets worse when it comes to database queries. Complex and conditional queries were extremely hard to manage and bug fix. When it comes to adding more to the existing complexity, it is basically a complete rewrite. Lastly, when it comes to building APIs for mobile applications, we had had to ensure a lot of complexity in build secure and maintainable services. This took a lot of time and effort.
There had to be a way to optimise this and it was this unignorable fact that made us want to find an option that allowed us to code faster, with more efficiency and a lot more scalability than before.
So what were we missing? We were missing an API layer and helpers in our code where we could still access the sweetness of Core PHP through API Hooks and yet have the ability to simply just plug a specific code and make use of its API goodness. Also, we needed a Database Query Helper, some sort of templating engine and encapsulation.
We started searching for some solutions which could fill these gaps… and we have found some. We started focusing more on OOPs. We incorporated composer packages for database queries. This helped us a lot in achieving speed while managing complex queries and extending them later. But we wanted more. We wanted to have a structure that the entire team could follow. We knew that MVC was the right way to go where we could make applications as independent as we wanted. This process would lead to a separation of concerns, manageability and scalability. What we really needed was a Framework.
Here's where things got interesting for the developers. Firstly what is MVC? MVC stands for Model-View-Controller - where the database architecture is hidden away with Models and Views are only concerned with rendering the data that is passed on to it and finally, the Controller where all the business logic and complexity are encapsulated.
We were constantly looking for a better framework and we had even created custom frameworks using Smarty, Fat Free, Eloquent, Routing and Helpers. But there was always a feeling that it wasn't enough.
I had some experience in Laravel and while creating my own Framework, I wanted to achieve what Laravel was able to achieve. Then the obvious dawned… If we really wanted our framework to be exactly like Laravel then why not use that instead. I was convinced and determined to use Laravel in our future projects. I proposed the idea to Zahir & Burges and when I explained what all that we can achieve with Laravel, they were completely on board with the idea. This journey would have been impossible without them. I can't even put into words how awesome Laravel is and to be able to bring in a drastic change in the development methodology was an exciting challenge,
This is my favorite part - talking about the Laravel PHP Framework
First thing anyone will notice in Laravel is that it is a Powerful and Robust Routing Engine. Many entry-level developers don't notice this but web routes are already CSRF safe. We don't even have to worry about that. Previously we had to build it for ourselves and those who have done CSRF protection manually know how painful it is.
Then comes the Templating Engine - Blade. Trust me when I tell you that the name suits it perfectly. It’s sharp and cuts through anything you throw at it. Blade is completely Injection safe, out of the box.
Then the database abstraction layer, Eloquent ORM. makes it an ease to perform complex database queries, managing relationships and later, scale them in breeze with the help of Models. I'm personally a big fan of Active Records myself. It represents queries like a readable paragraph. Query Scopes help to extend that even further. SQL Injection is history now. Many of us don't pay attention to the fact that Query Caching is built in. Then it has the migration files which is basically Database version control.
RESTful Controllers - this is something we fell in love with. Controllers allowed us to write our logic, broken down into multiple readable methods or in a separate classes. In Core PHP, breaking down codes was a big hassle. With controllers, we know where to look if anything goes wrong and debug it instantly. The validation is what makes it even more interesting. No more ‘if-else chain of hell’. You can literally do multiple complex validation in a single line. You can provide custom messages if you want or Laravel will give you pretty good messages for your invalid data.
Then comes the Artisan (I prefer calling it Laravel Personal Assistant). It is very powerful and extendable.Artisan is basically a generator for Laravel. Ask him to make a controller and he will do that for you. It comes with Tinker, which is a great console for playing with your code first.
The Helpers & Authentication make it easier to code by writing less and doing more in a bit of a cooler way to do it. Array Helper, Collections, Session, Cookies, Request the list goes on. I'll also mention the Mailer. Previously we had to work for hours to make a good Mailer but Laravel completely eliminated the headache.
I want to cover the authentication part here too. Laravel comes with basic Authentication Features out of the box. We almost always need User Registration, Login, Forget Password. Having pre-existing standard functionality helped us a lot in speeding up standard delivery. We just had to extend the actual logic over the basic authentication layer and we were good to go.
When we speak about authentication we have to mention Middlewares, Those are life-savers. User level authentication and permissions can be built in a minute. Not just authentication, hooking into the Request and Response with Marcos, which made it easy to build the Secure API. Now we don’t have to worry about the pre-processing of request and response in our main logic. They are automatically applied to the group of areas where we want it to apply.
The jaw dropping part is where we plug and play official or third party packages. This was a big leap forward for us. Form Model Binding where we now had HTML and Form Facades made our life much easier. No more manually filling a form while updating an entry. Want a Social Login? Socialite has got you covered. Want image optimization? Intervention Image is here for you. There are countless packages out there to help you with an API that you want to hook into and make your life easier. We have even created a bunch of our own packages that we just plug and play with Facades.
Now comes the challenge of building APIs for Mobile Applications. Laravel is made keeping in mind RESTful API Development. The security measures for the APIs with Laravel are great - built in throttling and database query or other services are really fast. This approach converted many lines of code to just a few lines.
We also realised that there were a few features we would have wanted within Laravel. One thing I really would expect from Laravel out of the box is CORS (Cross origin resource sharing) but no worries, we made a our own package for that as well. Build, plug and play! Simple! We are currently using a fork of Laravel and we integrated some of the functionalities into it that we constantly need in our solution like User Level Permissions, more Routes in Route Resources. We also made a full fledged CMS Solution for us to integrate on. It's easily maintainable and scalable. We custom build the backend modules as per the project requirements and the experience for us all is pretty amazing.
No, not at all. Core PHP helps you to understand the logic behind frameworks. Your logical thinking can be improved with Core PHP. Core PHP becomes bad only when it goes to a bad programmer’s desk. Don’t dive into Framework without learning or coding in Core PHP or without some good experience in OOP. Please make sure that you read the full documentation before you start coding in any Framework.
So now that I’ve ranted about how great Laravel is, I want to close by saying that this discussion is not about all the features Laravel has, rather, it a discussion about what attracted our team to Laravel and how we took the leap.
It was a challenge moving to Laravel from Core PHP. The transition wasn't so easy for all of us in the development team. We constantly fought our way through. We had to spend hours researching, learning, sharing and growing into the new development skin as a team. The early adopters took responsibility of making sure everyone was comfortable and now that the team has got the hang of it, they don't want to go back. I must say Laravel is pretty addictive.
We also had tons of clients running Core PHP solutions that were working perfectly fine. We rebuilt some of them in Laravel and we continue to maintain the rest in Core PHP till the revamp kicks in. One thing was for sure, anything current was definitely going to be built with Laravel.
For our clients, this development shift meant a heap of benefits. Faster deliveries, a larger focus on building custom functionality rather than spending hours on standard functionality, more maintainable, optimised and scalable code… the list goes on.
With Laravel, not only did we transform our development methodology, but we also converted our time invested in adopting Laravel into delivering better products to our clients and allowed ourselves to be more agile in the process of being a bespoke development company. This shift allowed us to have a better justification for our time and product.
What a journey...