Learn how to configure XDebug and PHPUnit in PHPStorm, allowing you to write better tests and fix bugs faster.
Test Driven Development (TDD) is an old topic, I know, but it seems many people don’t understand how it makes you write better code. The point here is that one of the most important benefits it’s to use debugging tools together with tests, making your flow more efficient.
I started using TDD on the command line, and still use it sometimes, but since I started using PHPStorm and decided to try how it handles tests, and that’s amazing! When you add debugging tools – like XDebug – to it everything starts making sense, then you have the feeling you’re on the right path.
PHPStorm has a dedicated interface to run and debug tests, almost in the same window, what makes the process of writing code safer and easier.
Continue reading Using XDebug with PHPUnit in PHPStorm
I developed some projects using Ruby On Rails some time ago, and I start to think about using AJAX in a different way. Rails uses a custom jQuery adapter to allow you to do things like that:
link_to("Destroy", user_path(@user), method: :delete, remote: true)
Continue reading Using Ruby on Rails Ajax adapter with any project, even PHP (like Laravel)
Here I’m again to write my first post in 2015. Last year I’ve wrote less and this year I have plans to write much more, telling about my experience with web development. I have plans to start screencasting too, but this is just plans 😀
I decided to start this year writing about WordPress. Last year I thought WordPress helped me and my company to develop websites faster with a bunch of nice features, making a better job and with less time I spent before.
So, today I’m starting a series about using WordPress to create websites. First I’m going to write about why you should use WordPress to develop your next website and after how you can do that, which plugins you can use and how to use them, one by one.
Continue reading Why WordPress is your best option for creating websites
Updated Mar 3rd 2015: Are you using Laravel 5? Check these changes!
Updated May 11th 2014: Using Corcel project
Currently I am working on a project where I had to make some choices about technologies and how work with them together. First this project will be developed using WordPress only. It’s a College Group site, where we had to work with 13 schools around the world and each one must has the control of your own content.
This could be made with WordPress, but I think when the site is not so small maybe you can use another CMS or Framework, because I particularly prefer to work with MVC. So because some decisions inside the company we decided to use WordPress Admin Panel, that is a very good, use its architecture and its database. So WordPress will be used to the application back-end, with user control, user permission, etc.
To the front-end we decided to work with Laravel. To query information from the WordPress database we’ve used the WordPress functions inside Laravel, so it’s much better to work with a MVC WordPress.
Continue reading Working with Laravel 4 or 5 and WordPress together
Let’s supose you want to develop your own URL shortener, like Bit.ly for example.
You can, of course, use the ID as a integer, like, 1, 2, 3, etc. If you have 12.345 rows in your database table, you will need 5 digits, like http://example.com/12345. Large applications like Youtube, have much more entries, so, to use numbers, the URL will be very long, like
Because that, these websites, like YouTube, t.co, bitly.com or even vine.co, are using a generated ID using uppercase letters, lowercase letters, digits and sometimes underscore (_) and hyphen (-). You can check that given a YouTube video URL where you will find something like
http://www.youtube.com/watch?v=2Z4m4lnjxkY. You can see they’re using the “2Z4m4lnjxkY” as ID.
Continue reading Generating IDs like Youtube or Bit.ly using PHP
We will work with codesleeve/asset-pipeline package. It’s easy to use and simple to understand.
Continue reading Managing assets with Laravel 4
One of the best improvements of the PHP 5.4 was the built-in web server. Like in Ruby On Rails, now you do not need Apache or Nginx inside your development machine.
To start a web server is easy:
php -S localhost:8000
Continue reading Working with PHP 5.4+ built-in server with Laravel 4
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.
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.
Continue reading Be a better PHP developer
These days I’m thinking about productivity and the use of PHP frameworks. I’ve read some posts about framework X or Y, defending a framework instead of another one.
I know people that use a framework like Zend Framework to develop a simple website just to say they’re using it, and not an “easy” framework. I think you must to solve the problem, not create another one. You have to use best practices but first you have to solve the problem, nothing more.
You don’t have to use a hard-to-learn framework just to say your friends you know about it. You can do amazing things with easy-to-learn frameworks, like Code Igniter, CakePHP, Laravel or Slim. You can do better even with pure PHP if you want, but you have to concern about productivity (and security of course).
Continue reading Solve the problem. Just it!
Today I am starting a post series about Design Patterns. I have wrote about them a lot but only suggesting you to learn about to be a better developer. I am studying them, so nothing better to write about and improve my knowledges too.
I only ask you to read everything to understand the concepts behind the patterns. You have to understand them to know where you can use one or another.
Continue reading Design Patterns with PHP – Adapters