Be a better PHP developer

Actually this post is a outflow and at the same time an advice. I have seen some PHP developers that are completely OUT of what is happening in the PHP world, besides committing some mistakes that cannot be accepted.

PHP 5.3+

If you are entitled as a PHP developer you must to update. In my opinion the best improvements of the language after version 5.3 were namespaces and closures. If you don’t know about it, UPDATE yourself, because these added functionalities allowed a fast growth of the language, and developers that are not using them are lagging behind.

Composer

If you are a PHP developer and you don’t know how to use a Composer package, study! Every new released package using PHP works with Composer (or should) , and you have to understand how it works first to understand how to develop your new packages or update the old ones you have.

Composer is a Dependency Manager for PHP. You can control packages, versions and much more. You do not need to use Composer only for frameworks or components that already use Composer. You can, for example, use a Database ORM like Eloquent or Zend Db with WordPress. It is very easy to use, but you have to know how it works before anything.

If you want to be introduced to Composer please visit my blog post about it. You really will be more productive using it. Believe me! Composer will allow you to use pieces of code from frameworks inside another one, what is very good.

Design Patterns

Don’t you know about Design Patterns? Ok! It’s in time to learn. Design Patterns are some default structure solutions to solve problems of design, but the application design (modelling). But, why should I learn that? Just to write a better code and improve reusability. With design patterns you will find some default common problems and every time you find that problem you will find a default design to apply, so it’s easy to solve design solutions in your project.

I strongly recommend the book “Head First Design Patterns”. You will find an easy (and cool) way to understand how these patterns work.

Frameworks

If you are a PHP developer that concerns about security and productivity I recommend you to use a framework. It will improve your development speed and you will have a better designed and structured application. Frameworks in PHP are like religions (be careful). You will find developers that “pray” about frameworks every day. They are boring people and they will try to convince you to use the framework they want. I don’t agree with this behaviour.

I guess framework is a personal decision and you can use the framework you want, and you have to like the way it works to solve your problem. If you like RubyOnRails, where things happen as magic, with a simple syntax and more human readable you will like Laravel or CakePHP. Laravel is a new framework (first version in 2011) but with a very fast development by a fantastic team. It is a fast framework (small footprint), where you will start to develop in a couple of minutes.

CakePHP is an older framework (first version in 2006), but the most used and with a very large and solid community. We have also other good frameworks If you came from Java you will be more familiar with frameworks like Zend Framework or Symfony. These frameworks work as a Java framework, with a hard use of OO and Design Patterns. Both are excellent frameworks and you will be very happy to use them too, if you like how they work.

I know I will receive many comments with “Why not Code Igniter? Why not Yii Framework?”. PHP has A LOT of frameworks and as I said before you have to choose one (or more) to work with and frameworks are like religious, so, you always will find who are not using the same framework you are. We have also other good frameworks like Phalcon, PHP Burn, Kohana, Fuel and more. Remember, if you like framework X but you want to use a package from framework Y you can do. Just use Composer and a new world will open in front of you.

Micro Frameworks

You have also the Micro Frameworks, like Slim or Silex. Both are very good micro-frameworks and generally give you a good route engines and template systems. You can use a micro framework together with others frameworks’ components. For example, you can use Slim with MongoDB libraries, Eloquent ORM from Laravel, Zend Framework 2 packages and more. They are common used for API development. Because they have a small footprint you can use them as a API base, what is very productive and simpler too.

TDD

Test is everything. Of course you have to start from basics before test more deeply. Test will make you to write better code and develop a very solid application, allowing you to be sure about your software integrity. Tests grantee your output and a single functionality of a specific use case. To start with tests I recommend working with Laravel. Laravel is test driven, so it allow you to test in a very easy way, using your own way. Start to use TDD with it and you will understand really how TDD works.

PHP Conventions

PHP has changed a lot since last years. A good read is the webpage PHP The right way, where you can find how to use the newer tools to be a better PHP developer. I strongly recommend you to read this page and think about what is happening into the PHP world.

Create a blog

You should have a blog. A blog allow you to write better and to learn more too. When you receive your first comment – good or bad – you will have a good feeling and this will motivate you to write more and contribute more. Since I created my blog, 2 years ago, I have received many good comments and this is awesome. I can’t describe what I feel helping other developers and this help me to learn more and to meet more people too.

Profiles to follow

Below you have a list with some cool people/projects to follow in the PHP world. These people are people behind big frameworks, big companies or excellent packages.

  • Slim Framework (@slimphp): The team of Slim Framework (micro framework)
  • Konstantin Kovshenin ‏(@kovshenin): WordPress theme developer
  • SaraMG‏ (@SaraMG): Facebook PHP developer
  • Jordi Boggiano ‏(@seldaek): Composer lead. Symfony2 developer.
  • Josh Lockhart ‏(@codeguy): Creator of Slim Framework and PHP The right way
  • Dries Vints (@DriesVints): Laravel enthusiast
  • Jonathan Torke (@JonathanTorke): WordPress theme developer
  • Pablo Dall’Oglio ‏(@pablodalloglio): Brazilian writer and PHP developer
  • Laravel Ins and Outs ‏(@LaravelIO): The official Laravel community portal
  • Dayle Rees ‏(@daylerees): Laravel core team member
  • Taylor Otwell ‏(@taylorotwell): The creator of Laravel Framework
  • Laravel ‏(@laravelphp): Official Laravel Twitter profile
  • Sebastian Bergmann ‏(@s_bergmann): The creator of PHPUnit
  • Derick Rethans ‏(@derickr): Author of the Xdebug
  • jose_zap ‏(@jose_zap): CakePHP core developer
  • Fabien Potencier ‏(@fabpot): Creator of Symfony PHP and SensioLabs
  • Rasmus Lerdorf ‏(@rasmus): Creator of PHP
  • Larry E. Masters ‏(@PhpNut): CakePHP founder
  • Rafael Dohms ‏(@rdohms): PHP developer and evangelist
  • Pádraic Brady ‏(@padraicb): Zend Framework contributor
  • Michelangelo van Dam ‏(@DragonBe): PHP and Zend Framework developer and evangelist
  • Zend Technologies ‏(@zend): The company behind PHP
  • Ryan Mauger ‏(@bittarman): PHP developer and Zend Framework evangelist
  • Rob Allen ‏(@akrabat): Author of “Zend Framework in Action”
  • weierophinney ‏(@mwop): PHP and Zend Framework developer (core team)
  • CakePHP ‏(@cakephp): The official CakePHP Twitter profile

Published by

Junior Grossi

senior software engineer & stutterer conference speaker. happy husband & dad. maintains Corcel PHP, elePHPant.me and PHPMG. Engineering Manager @ Paddle

6 thoughts on “Be a better PHP developer”

  1. “For example, you can use Slim with MangoDB libraries” – Never heard of MangoDB. What a beast it suppose to be 😀

    I think you meant MongoDB. Maybe I’m wrong, but I couldn’t find MangoDB in Google.
    Anyway, this is a good article!

    “Above you have a list with some cool people/projects to follow…” – Maybe below?

  2. Just want to say 2 things:

    1) Nice Article, congrats and tks
    and
    2) Please include PHPBURN in the frameworks list 🙂 its a very nice framework with a growing community, very light and stable.

    🙂

    1. Hi Klederson!

      Nice to have you here reading my blog 😀
      I’ll include PHPBURN in the frameworks list hehe. I’ll take a deep look on it too.

      Best regards and be welcome!

  3. Great advice, man! I would also add: get out of the PHP shell too and go try some other langs so you can use PHP better.

    I don’t develop much on PHP anymore, so being I out can pretty much see the PHP world needs to be better valued, because of it’s awesome environment.

    But, for that to happen, developers need to get better and show their work, otherwise they will be stereotyped as just another PHP developer, since they are some many people that call themselves developers just because they wrote a script in PHP, thus making the impression most PHP devs are not good, which is not truth at all.

    1. Awesome comment Lucas.

      I agree with you. When developers go out from PHP and know other languages they start to think different. For me, using Ruby open my mind about simplicity and code reuse. I guess we have very good developers but the PHP community needs to change to get more involved and it has to start to be around the news in the developer community, not only PHP.

      For example, PHP developers must go to conferences outside the PHP language, like NodeJS events and others. This make them better developers to solve problems using different ways.

      Thanks for the comment!

Leave a Reply

Your email address will not be published. Required fields are marked *