As blogging is sort of a new thing for me. There needed to be some inspiration for me to write something. Many of you will find out, probably quickly, that English tends to be my second language. My first being silence, which I don't practice often enough.
So, for my first venture into blogging I decided to chronicle my setup of a brand spankin new development environment. After having spent numerous years using virtual machines for development this should be easy... or the exact opposite of easy. It never fails every time I set one up I stumble over the same problems I have forgotten about or new ones crop up. I prefer the new problems since it means I have ventured out of my comfort zone.
Now the inspiration side of things. For the last 5 years I have been primarily focused on developing PHP using Zend Framework. It seemed about time to learn something new. After thinking about it for some time I decided to check out Laravel. It seems to be a hot little framework that I keep hearing whispers about when talking to other PHP developers. I could have gone with Zend Framework 2 but I think it's time to venture outside of the Zend garden for a bit and see what else is going on.
Some of the reasons for choosing Laravel...
- Like I mentioned, I have been hearing some talk about it so I want to see if it lives up to the hype.
- After reading some of the web site it claims to have great documentation. Something Zend Framework has been lacking for years and is just now starting to get better at.
- Fast setup, get coding without needing to jump through a lot of configuration hoops. Although Zend Framework can be fairly quick to setup if you have worked with it for awhile. The problems usually start creeping up on you when trying to find out how to implement certain configurations. Since Zend Framework has been around for awhile there is a ton of information that is deprecated, or just too many choices. The sheer volume of ways to do something as simple as multiple database configurations for example, can be daunting.
- Something that I could learn and teach others about at my local PHP user group which I am involved in.
Keeping with the theme of development I also decided to take a TDD approach to my research and learning. I have outlined a set of test cases that I want to pass as I am setting up my environment and hacking away at Laravel. One of the test cases I had in mind was documenting my journey (blog). So here are my test cases which I will be blogging about over the course of the next several weeks.
public function createBlogDetailingResearch()
{
$this->assertTrue($this->blog->hasPosts());
}
Clever, huh? Did I mention I was funny too?
OK, so maybe I lack skills as a comedian. Also I decided I was not going through all my test cases and actually try to make real associations to phpunit assertions and testdox test case function names.
As each test case is complete I will update with the following with permalinks when applicable.
Blog About My Setup
Still in progress but I have a start with this post.
Use VirtualBox For My Virtual Machine
I wanted to make sure that if I wanted to include others in a live coding session I can easily pass out something open source and cross-platform compatible. Since my VM software of choice is VMWare Fusion on a Mac I need to iron out some issues I have with VirtualBox.
Use A Production Quality OS
This is falling more on preference but I needed a good excuse. Ubuntu is fairly easy to get up and running and there is a ton of information on the internet about setting this up. The problem is I don't see a lot of people running Ubuntu in a real live production setting much. The OS of choice right now seems to be CentOS for production grade open source Linux OS. Also, since I use this primarily at work I have a few resources if I get stuck somewhere with my mediocre Linux skills.
Use Zend Server CE
I know this somewhat contradicts my previous statement of departing from the Zend garden. The choice was simple, I did not want to hassle with trying to get debugging going with XDebug. Using Zend Server I can get Zend Debugger running quickly. Having more experience with this debugging tool over any other will hopefully prevent me from patching holes in my walls. Again I have resources who can help when Google fails me. I want debugging so I can easily step into the code and see the inner workings of the framework. I find this is a great learning tool and exposes a lot more than just reading the code and executing it in my head. Too much recursion can be a problem when just reading a framework.
Use A Good IDE
I will most likely be praising and promoting the crap out of phpStorm. In the last year I have been using it, I wonder why I ever used Eclipse based IDEs. This will probably be my biggest bias when discussing how to do things in the code. Also somewhat goes against my "choose open source applications" for the development stack. I know plenty of people who will likely follow along in VIM though, so to each their own.
Establish Shared Code Between Host and VM
This is my favorite way to work with a VM development environment. Keep all the tools in the OS of choice and run the code on the VM. Preferably there is no deployment process to make this happen. Save your code, run your code.
Host The Code So Others Can Fork It
It is rare for me to ever start any coding without source control. Even if I know I won't be doing much with it. Easily the one tool no developer should ever be without. For this experiment I will be hosting my code on Bitbucket as I am partial to Mercurial.
Get Laravel Up And Running
Now we are getting somewhere. This will be the outline of how easy or difficult getting just the initial Laravel framework up and running anything. My hope is this post will be extremely short. I will also be concentrating on doing this manually unless when using predefined scripts that seems to be the way to go. I want to be intimate with Laravel not just a casual observer.
Configurationing With Laravel
Most of the time I can breeze through this with Zend Framework. OK, almost never because I seem to be on a every year or so cycle where I have a blank slate to configure. So either I reference what I have done in the past or I fire up Google and look for answers. My hope is this is straight forward. Even though I like flexibility to do things my way, bonus points if it is not a choose your own adventure.
Let's Make An App
I will keep it a secret for now what app I plan on making. Alright, I am still debating the exact project I am aiming for, but I have ideas. This post will concentrate on some specifics of what I hope to accomplish quickly. Since I know Laravel is an MVC framework much of the architecture and planning will revolve around that idea.
Making A Request
So many different paths to choose from anymore. Do you build a RESTful application? Stick with old school RPC? I find it can be a mix. Will Laravel let me do this easily? Can I choose the path that is right for me?
Forms And Validation
One of my favorite features in Zend Framework revolves around Zend Form, Validators and Filters. Does Laravel give me a good flexible option like Zend? Does the validation and filtering make sense? Do I need to struggle with decorators or will Laravel help me ditch that long lost pain in my ass?
Sexy, Sexy Models
I prefer skinny controllers, fat models and a good service layer. Does Laravel tie me into an Active Record pattern? Will it be flexible and allow me to create models of my objects while leaving the dependencies injectable? Oh, you thought I was going to talk about something else?
Good Service
If I have a 3rd party dependency or any kind of external dependency I want to keep that abstracted out into a service layer. How is Laravel's query abstraction for SQL? Does it have potential security flaws? Does it use PDO? Does the query language it provides make sense? Can I make complex queries easily that make sense?
Testability
When I put everything together how easy is it for me to test my application? Does Laravel supply me with patterns that make this task easier or more difficult? Obviously I can choose how to write my code in a way that is testable, but I want to see if the framework encourages this or gets in my way. I also want as much of the whole stack to be testable from the controllers to the services. Where if any are there gaps that I feel should be easier to test.
Plugins or Bundles
Since Laravel promotes bundles I want to see how this helps me. Does it really make it easier for me to stop re-creating the wheel? What if I want to make my own, how difficult of a process is this?
User Interface
How does Laravel help me integrate with some of the newer UI frameworks available. I will most likely look at using Twitter Bootstrap and trying my hand at HTML5. Will the framework help or hinder me?
Build A Presentation
As a final step I will bundle all the things I do and make a presentation for the
Front Range PHP User Group . Keep an eye out for my presentation or join our
Meetup group, you can even like us on
Facebook. If you are in Denver, CO or anywhere close, come check us out!
Codelobster is great IDE for Laravel too. It has special plug-in for autocomplete.
ReplyDeletecustom php development
ReplyDeleteis always a hot choice for business development because php is capable of operating on both Linux and Windows servers and also it is a open source language that makes it a cost effective solution.
Useful article, thanks for sharing!
ReplyDeleteTecocraft is a trusted PHP development company providing utmost quality solutions for various business needs.
ReplyDeleteWe are a top development company provide the best solution for your startup or business.
ReplyDelete