Automate Your PHP Coding with PHPbot


Anything that can save time on a dev project is worth trying. Developers know this better than anyone, which is why IDE plugins and complex regex snippets are so valuable.

For PHP development, there are plenty of libraries such as Laravel and even the WordPress CMS framework. But, coding PHP still requires line-by-line development, which is where PHPbot can help.

This free web app auto-generates templates for PHP code, based on whatever command you enter. It sounds complex and prone to error but this thing really works!

PHPbot web app

You start by entering a phrase related to a PHP function or a phrase from the PHP manual. For example, if you type ksort you’ll get a full template based on the ksort() method (which sorts a PHP array by keys).

The PHPbot responds quickly with not just a snippet, but a usable snippet. Here’s the example I got for the ksort command:

$fruits = array("d"=>"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple");
foreach ($fruits as $key => $val) {
    echo "$key = $valn";

You can easily change the $fruits array data to fit whatever you need. This way you’re not writing everything from scratch and you can be sure the PHPbot’s response is 100% error-free.

Declare statement PHPbot

Note that PHPbot is still a work in progress, so I can’t claim it won’t ever give erroneous code. But, the developers of PHPbot work hard to fix all errors, so it’s getting more reliable with each passing month.

Anyone brand new to PHP will also find this bot useful for studying code snippets. Once you get PHP installed locally, you can build your own applications and test fast with the PHPbot snippets.

This thing is definitely worth bookmarking and testing with PHP functions that you don’t understand or just can’t memorize.

Also if you have any questions, bug reports or suggestions for improvements drop a message to the official Twitter account @phpbotapp.

Source link