In the last part we covered setting up our project and getting our Engine::render() method to render our view file and interpolate the variables passed into it. Already it is more useful that using PHP on it's own to display pages. However, we want more than that. We want to eventually be able to have a new syntax for out variables, loops and conditional statements.
Almost a year ago now I worked on a contract where I was required to convert legacy PHP code, which had been written by a non-programmer. For the refactoring I first redesigned the database entirely, refactored any of the business logic out of any files which rendered content, and organised the entire structure. I created a simple router which was used to map simple urls to views which where rendered using an output buffer. I then set about finding an MVC framework to incrementally integrate with the refactored app.
After a few days of research, I chose Silex. Silex is very minimal and unopinionated. It also has very good documentation, including how to add Twig, the Doctrine DBAL (the ORM takes a bit of work) and many of the Symfony packages (Monolog, Swiftmailer, Session, Serializer, Assets and more). The best part was I could use Silex on it's own initially while moving my existing code to routes and controllers, and only then add a template engine and DB library. It also allows you to decide the structure yourself. As the project evolved I was able to rework anything that required it and add any library that could be PSR autoloaded easily.
So lately I've been writing a few composer packages which all have something to do with working with files or the file system; Affinity4\File, Affinity4\Config and Affinity4\Concat. While writing these packages I have needed to test the packages work on files in a consistent way. For example, in the beginning my tests where passing on my Windows machine and failing when I committed them. TravisCI was telling me the paths didn't match. Obviously because of the directory separators for files paths didn't match from Windows to Linux.
My very first book was published in late August 2016. The book Mastering Sass is published by Packt Publishing and is available in ebook (PDF, Mobi, Kindle) format or print.
It covers advanced Sass, Compass and Susy techniques to create responsive, data-intensive web applications such as e-commerce websites, news websites or anything else.
I’ve done the “creating and adding SSH keys from Git to Github” process possibly 5 times now in the past 3 -4 years. Each time I had to just follow along blindly with the Github guide and cross my fingers and pray I got all of the black magic incantations correct and didn’t accidentally unleash the hordes of hell upon the world by my copy/pasting.
So recently I got a new laptop and the day I bought it I remember being happy I had a nice new laptop with a touch screen and Windows 8, which I really like! I’m not an idiot who can’t adjust to a new menu. “Oh Noes! A menu that covers the entire screen instead of just a quarter. How will ever manage??”. Come on people!