Today we are super excited to have Phil Sturgeon with us for this interview. Phil is a cool dude and an experienced API dev. He has a lot of experience in creating API for different platforms. Right now, he is working at WeWork as a Platform Engineer. He has written an excellent book on creating API, “Build APIs You Won’t Hate”. He has worked with popular PHP tools and frameworks including CodeIgniter, FuelPHP, PyroCMS. Phil also contributed to PHP The Right Way and PHP-FIG.
Phil also speaks at PHP conferences and often mentors budding developers. In this Interview he talks about his development experiences, workflows and experience with API development.
Cloudways: Hi Phil How are you? It’s great to have you onboard for this interview. How did you get started with PHP development and what motivates you to be such an exceptional developer?
Phil: Hey! I’m certainly not exceptional! I just blog more than most developers. Talking about what you’re working on is super helpful for other developers as they learn new things. Taking topics that I think are really difficult, grinding them down until I understand them, then posting about them in simple humanspeak has always been a successful process for me.
Cloudways: Programming needs a lot of practice and a mentor to help them along the way. Who has been your mentor(s)?
Phil: Martin Fowler is an exceptionally clever developer, and always has good advice written about a decade before I needed it. I’m generally inspired by my friends in the PHP League, who are always making cool stuff, and teaching me new things. Alex Bilbie has taught me a lot about OAuth that I really would have suffered without.
Cloudways: Phil, many developers consider PHP 7.x as a major achievement for the language. What do you think of PHP 7.x and how could developers use it in their projects?
Phil: PHP has always suffered inconsistencies in various forms. Now with uniform variable syntax, abstract syntax tree, context sensitive lexer, PHP 4 style constructors going, internal class constructors behaving, PHP has made a huge leap towards having a consistent lexer, parser, and engine.
This has allowed for performance gains, and code cleanup along the way, with handy new features being added alongside! If PHP 8 can solve the standard library inconsistencies, PHP is going to be in a very pretty position.
Cloudways: How do you manage multiple projects. What development workflows and tools do you use?
Phil: Vagrant and Docker help keep projects wrapped up and isolated, so most of the time I use those if the dependencies are complex enough to warrant it. These days, I’m working mostly on APIs, so a lot of the time I just pull down the git repo, composer install, php -S or run the test suite.
Cloudways: You are an active contributor to PHP-FIG. How PSR standards help developers in creating robust code?
Phil: Not anymore! PyroCMS was bought out a while ago. I stuck around for a while to provide input when I thought I had something to offer, but these days the FIG has things nicely under control. Internally, they nicknamed a new approach for the group “FIG 3.0”, which has the focus on working groups, standards that require implementations to exist in the wild, and a more standards-body-like approach to generating standards.
In the history of the FIG, some of the recommendations were considered to be rushed, and some took two years to produce a result most folks weren’t happy with. This new approach should solve all those problems.
Cloudways: You have authored several books on PHP and several CMS. What advice would you give to developers who wish to get their work published?
Phil: Just publish it yourself. Traditional publishers offer an advance (a loan), and they’ll keep 100% of your royalties until that loan is paid off. Afterwards, you might get 40% of royalties, which is pathetic. LeanPub give you 90% of the eBook royalties, then you can use CreateSpace to make the physical book if LeanPub does well.
LeanPub recommend “publish early, publish often.” This approach is awesome, as I started selling a highly discounted version of the book after a few chapters, then the sales motivated me to continue writing. Spending a few hundred dollars on a great cover design will get you drastically more sales, and the returns will dwarf the initial cost.
Cloudways: I see that you have done a lot of projects in Codeigniter. Are you partial to Codeigniter or would you recommend some other framework(s) to developers?
Phil: I quit CodeIgniter years ago, because it was in a strangle hold by the company who owned it, and they refused to allow it to change, or adapt to leverage any new PHP features since PHP 5.2. These days some students are taking care of it, but it’s so far behind everything else it will be a brand new framework if it ever manages to get v4 out. Use Slim, Lumen or Laravel.
Cloudways: At conferences, you often speak about the benefits and usage of API. How would you differentiate between REST API and web services?
Phil: An API is an application program interface, which most web services have. You need to interact with a web service somehow, so whether that is via HTTP, AMQP, etc., that is an API.
REST is an architecture that outlines a set of principles, which can help an API last for decades. REST is commonly implemented in HTTP, but could be implemented in anything.
Cloudways: What do you do for fun? Do you enjoy the outdoors? What are your hobbies?
Phil: I ride bikes a whole lot. I’ve been doing a lot of multi-day rides to raise money for charity, exploring the mountains near New York and New Jersey, and racking up a few thousand miles per year in the process. These days I’m getting into road and cyclocross racing, and it’s a whole pile of fun.
Cloudways: Phil, What do you think about managed hosting solutions like Cloudways that provide a full-featured and highly optimized PHP stack with Laravel and other applications? Do you think that managed hosting solutions help developers kickstart web projects without worrying about server management issues?
Phil: I think they’re a great idea. A lot of developers have zero interest in managing their production stack, they just want to write code and get paid. Maybe they want somewhere to host their clients websites, without being phoned at 3am complaining some site they were paid $200 for 3 years ago is down. If Cloudways can help avoid that, it’s a winner in my books.