In the modern-day world of nimble start-ups and silicon valley, the buzz is everything about Ruby, Python, and whatever the most up to date cool programming language or structure to come out is. Older technologies don’t get much love, and PHP especially has a bad track record. In this post, I’m gonna review why and how we use PHP as a contemporary technology, and the different other tools, techniques and development methods we employ to run as agilely and elegantly.
PHP is considered an awkward and unskilled technology, best left to development newbies and $5-an-hour experts. It’s virtually bad enough to make me feel embarassment when I inform individuals we operate on PHP. However, I don’t think this reputation is entirely deserved.
The language itself is, after Perl, the earliest language to be embraced en-mass as a web technology. Its roots are as a text pre-processor, and over the past 16 years it has evolved from that into something much broader. Numerous of its fault stems from the means it has progressed, rather than being designed the method it is today from the ground up.
I’m not going to say PHP is the best language– it clearly isn’t. Frankly, it’s a mess. There’s no consistency in function and class names, even within the core library itself. The Object-Oriented features were added at a later point and, while they’re getting better, are somewhat delicate. Right here at Vizteams, the core requirement is that we work on a minimum of PHP 5.3, which presented Late Fixed Bindings. Prior to that, developing major object-oriented code in PHP was difficult.
Even for all its faults, PHP stays a significant gamer online, and a few of the most outstanding technology companies (like Facebook) are using it. PHP stays one of the fastest language to code with, deploy and carry out. Lastly, while this is mainly due to personal preference, I discover its C-inspired syntax to be one of the very best in the internet development world. Braces, parenthesis and semicolons make it very clear what the code is doing, rather than Ruby’s mess of symbols, suggested parenthesis and lack of statement closings.
It’s critical for a contemporary internet app to operate on an MVC (Model-View-Controller) architecture. Regrettably, PHP offers very little in terms of modern-day and agile MVC structures. The big ones (CodeIgniter, Symphony, etc.) are extremely bloated and in fact have the tendency to enter your way more than aid. Also, most enforce their vision of what the model & data source layers ought to resemble.
Fortunately, one framework sticks out from the pack. Paraglide is a minimalist framework that takes care of transmitting demands to controllers, rendering views, and little else. It offers the essentials in terms of establishing the environment, providing basic helpers and arranging your code. It also works on the command line and from a shell (more on this later.) It makes coding in PHP as stylish, and in some ways much more sophisticated, than the equivalent in Rails. It’s faster and lighter weight than Rails, however is easily extensible and works with basically any other code or package you toss its way.
Another decision core to our design suitables was the option of MongoDB as our primary design layer. Mongo is an incredibly powerful and scalable data source system. It’s essentially different from MySQL during that it is at its core a key-value establishment. Mongo is so exceptionally effective that we have in truth entirely avoided the normally needed step of using Memcached. Mongo also offers greater reliablility and security than MySQL with features such as failure-proof replica sets, and a querying interface that’s invulnerable to injection attacks. Avoiding SQL completely has actually also been exceptionally enjoyable. Among Mongo’s biggest benefits is easy and effective scaling through replica sets. When a node decreases, or is included, Mongo will immediately acknowledge it and rebalance itself, without causing any downtime. There is no single-point-of-failure.
A pet project of mine has been MongoModel, and it is what we utilize as the 3rd leg of our architecutre. MongoModel is an ORM which uses Mongo as its datastore, and adds features crucial to a full-featured web application. It offers object-mapping, relationships, recognitions and is incredibly stylish to use. Similar to with Bed rails’ ActiveRecord, reasonable defaults are deduced, and it’s schema-agnostic. You do not need to setup and even specify what your data source appears like. Rather, you simply utilize the items and MongoModel cares for everything else.
While we don’t practice Test-Driven-Development, we do have unit tests in place. PHP does not offer a sophisticated test library, so we developed our own (soon-to-be open-sourced.).
Shell Development & Scripting
Paraglide is, to my understanding, the only PHP structure that works in command-line scripts and from an interactive shell. Script functionality is extremely important in order to run cron scripts and various other maintenance and administration tasks. Interactive shell gain access to is a benefit for quick development and debugging. We use PHP-Shell to communicate with our code directly from the command line. This is quite similar to Bed rails’ script/console.
Everything we do is kept in Git. Git’s virtues are popular within the community, so I will only state that git has actually been extremely useful in keeping track of our code, the history, and for partnership. We even make use of git as a wiki, to keep an eye on our documentation and numerous other internal documents.
All our git repositories are hosted on GitHub. The main value of this, besides the hosting and beautiful user interface, has been to utilize the social functions to keep an eye on who’s been doing what. GitHub makes it actually easy to have a summary of what’s happening. It also handles user accounts and rights beautifully.
Our primary server-side code lives in a Git repository. We have committed branches for production code. We make use of Capistrano for deployments. The git repository has a devoted branch for production code, which we combine to as we deploy stuff. A script will automatically run device tests on anything that is pushed to manufacturing.
Amazon Web Services
VizTeams counts on Amazon Internet Services’ many products, consisting of EC2 for cloud servers, S3 for data storage, SES for emailing and numerous other smaller services. This lets us pay for just how much we utilize only, and allows for easy and fast scaling. We have an image prepared to be deployed to brand-new nodes, so we can handle any traffic thrown at our app.
Communications & Internal Tools
Finally, there’s the tools we use internally to keep in sync. Lighthouse cares for our bug-tracking needs, while its companion, Tender manages support. We utilize Campfire for group chats, and GO FOR one-on-ones. Google Apps & Gmail care for our emails. Also have a look at companion Mac apps Lighthouse Keeper for Lighthouse, and Propane for Campfire.
If you read this far, you now have an excellent summary of the numerous devices and strategies we utilize to code agilely at VizTeams. Although we chose an undesirable language to base our technology on, I believe it has actually helped us greatly. With this post, I intend to spread the love once again for PHP and these various methods of using it in a modern-day environment.
VizTeams has over 300 experts with the history of successfuly delivering over 500 projects. VizTeams serves cllient inside North America specifically USA and Canada while physically serving clients in the cities of Seattle, Toronto, Buffalo, Ottawa, Monreal, London, Kitchener, Windsor, Detroit. Feel free to contact us or Drop us a note for any help or assistance.