Don’t forget to install CURL after installing PHP. The Symfony PHP framework needs it, WordPress needs it. Most websites running PHP need CURL.

I find something will need it and if your website is going to talk to other websites, you’re probably going to need CURL. Just make it a habit before rebooting after you first install your Apache or other server to run this extra line to grab CURL:

$ apt-get install php5-curl

 


I occasionally jump onto my VIM emulator in PHP Storm and use it to do some special editing and selections, but I found PHP Storm has so much convenience with the mouse I hardly bother using all the time saving tools VIM has to offer.  I hear VIM is a great web development tool that helps coders write code faster because they can do more with just the keyboard.  Many diehard VIM coders claim they don’t ever use a mouse.  To each their own.

Here is a great cheatsheet for all you web developers out there who despise using the mouse and would rather be able to do more just with the keyboard.  For me, I like the extra exercise, so it’s okay.  Check VIM out, though, I noticed for some coders they just can’t say enough good things about VIM.  How does VIM save you time?  What special quick keys and commands do you use?!  I’m always looking to improve efficiencies for me and other web developers.  I’d appreciate your tips!


In most PHP frameworks or any basic MVC systems, you are probably using a lot more, if not completely exclusively, associative arrays to send data to classes and their methods, to databases, and receiving data back from libraries interacting with databases that will provide your scripts in an associative array format. The key/value pairing is a staple in database and systems, it makes the most sense in most applications.

There might come a time when you need to know if a certain array key exists, so if it was returned you could then act on it. This is similar to the “stristr()” function for strings, or a close neighbor to the “in_array()” function for array values. The point is, you need to sometimes look in order to act and the lack of an array key in some object’s method’s results might be vital information your script needs to continue, redirect, or stop based on such conditions.

As easy as it sounds, I have seen a lot of code written that loops through each array element to manually check if a key was set, then breaking the loop once found. PHP has a function built right in, so get rid of all that code and simply use “array_key_exists()”!

// Old code from someone who didn't discover PHP.net or just wanted to overcomplicate things to create "job security":

$foundKey=false;
foreach($search_array as $key=>$val){
if ($key=='keyToFind'){
$foundKey=true;
break;
}
}

// Or, just use the built in function the great folks at PHP created:
array_key_exists('keyToFind', $search_array);

Visit http://php.net/manual/en/function.array-key-exists.php for more information.


For web development and writing mostly code in PHP / Symfony, I prefer PHP Storm.  I do also use the Eclipse IDE and have been happy with its latest version, Eclipse Luna, since it has a Symfony, Twig and YML modules which are full of code helpers and on-the-fly validation and overall it is very expandable.

One thing I do like is changing the themes of different code environments, it’s easier to get in the mode.  Also, I like black screens, after staring a the monitor all day, I think it’s much easier on the eyes than white backgrounds.  I might think about changing my WordPress admin theme, come to think of it!

Changing the theme in PHP Eclipse is fast and easy:

1.  Go to Help > Install New Software…

2.  In top field, paste “http://eclipse-color-theme.github.com/update”  and click the “Add” button

3.  Restart Eclipse then go to Window > Preferences > Appearance > Color Themes  and select your favorite theme.

Eclipse-change-theme-ide

I personally like “Retta” or “Vibrant Ink”, I like to use one theme for PHP projects and a different color theme for Java, it helps keep the mind in one zone or the other, but that’s just a personal preference.  Eclipse has come a long way and as a free IDE, it is amazing in its versatility.

A great product and community keeps it stable and always on the leading edge of innovation.  I am looking forward to playing with it when I am learning the “Play” Java framework, which is eerily similar to Symfony 2.5.  Makes you wonder if they’re not the same or who came along first…  Either way, I sure am grateful they’re out there!

Visit www.Eclipse.org to learn more.

 

– Aaron Belchamber
www.AaronBelchamber.com

 


If you are looking to learn more about the Symfony PHP framework, you can gain confidence watching a real pro slug through a few projects and pick up a lot of great, helpful tips along the way while chuckling at the real English he pervasively sprinkles with entertaining British anecdotes and self-outrage.  Chris, you’re really hard on yourself, and you are by no means a NOOB!  🙂

I finally made it over the Symfony hump and must admit that I wish I learned a PHP framework much sooner.  If you’re on the fence, learn one, trust me, it will be well worth your time.  If you’re stubbornly refusing to look into a PHP framework, the era of “cowboy coding” is over, you will be irrelevant in about 3 years unless you adapt.  Perhaps you should consider learning COBOL and specialize in migrating their COBOL code to web-based and bring them into 2003.  At least they’ll be in the same millennium!

http://mossco.co.uk/symfony-2/free-symfony-2-tutorial-videos/

Why use a PHP framework?

If you use jQuery, Prototype or Angular to speed up your Javascript development, PHPMyAdmin or MySQL Workbench to speed up database design and development, you are already using tools and frameworks to support your web development process.  These are tools probably already in your tool kit which help you accelerate development time by freeing you up to focus on writing more effective, better designed, and more intuitive code without worrying about the tools you need to accomplish those tasks.  Often, we need to use the same tools on other projects, and this interchangeability of the tools in frameworks is where you will achieve compounding returns each time you use it.  There’s a familiarity and understanding, a common ground everyone in your development team will start from.

You will find when you delve deeper into these frameworks that they save you a lot of time so the quality of your code and what it can do is better thought out, structured, ready for re-use, and the results will be exponentially better.  Learning a PHP framework is an investment to better collaborative development environments and smoother sailing for any company who depends on a website.

Future proof your web assets

Another big reason to consider moving your web department to a framework is future compatibility.  As your company grows its web assets, you may expand and find yourself in need of another web developer.  The younger developers may only understand and be effective through a framework.  Sure, the more experienced who don’t use frameworks may argue that they have written a few pseudo PHP frameworks in the past, but those libraries and tools they made were custom built.  Without standardization and a common experience and understanding, unlike many developers share with the real frameworks like Symfony, Zend, CakePHP, Laravel, CodeIgnitor, or Yii to name a few, your company will not gain the benefits these PHP frameworks inherently provide.  It’s compounding returns and with the exception of Zend, moving to a PHP framework will cost you only in time, but the trade off for the future will put you in a much stronger position with much stabler websites and code that will be written that will not only last longer, but be much more useful and effective to your company.  That means more profits with compounding returns and less waste, a pretty good combination, don’t you think?