{"id":39441,"date":"2017-11-09T21:01:32","date_gmt":"2017-11-09T13:01:32","guid":{"rendered":"https:\/\/www.hongkiat.com\/blog\/?p=39441"},"modified":"2017-11-09T18:59:14","modified_gmt":"2017-11-09T10:59:14","slug":"automate-php-coding-phpbot","status":"publish","type":"post","link":"https:\/\/www.hongkiat.com\/blog\/automate-php-coding-phpbot\/","title":{"rendered":"Automate Your PHP Coding with PHPbot"},"content":{"rendered":"<p>Anything that <strong>can save time on a dev project<\/strong> is worth trying. Developers know this better than anyone, which is why <a href=\"https:\/\/www.hongkiat.com\/blog\/sublime-text-plugins\/\">IDE plugins<\/a> and <a href=\"https:\/\/www.hongkiat.com\/blog\/regex-web-developers\/\">complex regex snippets<\/a> are so valuable.<\/p>\n<p>For PHP development, there are <a href=\"https:\/\/www.hongkiat.com\/blog\/best-php-frameworks\/\">plenty of libraries<\/a> such as Laravel and even the WordPress CMS framework. But, coding PHP <strong>still requires line-by-line development<\/strong>, which is where <a href=\"https:\/\/www.phpbot.org\/\" target=\"_blank\">PHPbot<\/a> can help.<\/p>\n<p>This free web app <strong>auto-generates templates for PHP code<\/strong>, based on whatever command you enter. It sounds complex and prone to error but this thing really works!<\/p>\n<p class=\"note\"><strong>Read Also:<\/strong> <a target=\"_blank\" href=\"https:\/\/www.hongkiat.com\/blog\/php7\/\">PHP 7: 10 Things You Need to Know<\/a><\/p>\n<figure><a href=\"https:\/\/www.phpbot.org\/\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/automate-php-coding-phpbot\/01-phpbot-webpage-header.jpg\" alt=\"PHPbot web app\" width=\"1220\" height=\"639\"><\/a><\/figure>\n<p>You start by entering a <strong>phrase related to a PHP function<\/strong> or a <strong>phrase from the PHP manual<\/strong>. For example, if you type <a href=\"https:\/\/www.php.net\/manual\/en\/function.ksort.php\" target=\"_blank\">ksort<\/a> you\u2019ll get a full template based on the <code>ksort()<\/code> method (which sorts a PHP array by keys).<\/p>\n<p>The PHPbot responds quickly with not just a snippet, <strong>but a usable snippet<\/strong>. Here\u2019s the example I got for the ksort command:<\/p>\n<pre>\r\n&lt;?php\r\n$fruits = array(\"d\"=&gt;\"lemon\", \"a\"=&gt;\"orange\", \"b\"=&gt;\"banana\", \"c\"=&gt;\"apple\");\r\nksort($fruits);\r\nforeach ($fruits as $key =&gt; $val) {\r\n    echo \"$key = $val\\n\";\r\n}\r\n?&gt;\r\n<\/pre>\n<p>You can easily change the <code>$fruits<\/code> array data to fit whatever you need. This way you\u2019re <strong>not writing everything from scratch<\/strong> and you can be sure the PHPbot\u2019s response is 100% error-free.<\/p>\n<figure><a href=\"https:\/\/www.phpbot.org\/#Bot\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/automate-php-coding-phpbot\/02-phpbot-example-declare-statement.jpg\" alt=\"Declare statement PHPbot\" width=\"911\" height=\"712\"><\/a><\/figure>\n<p>Note that PHPbot is still a work in progress, so I can\u2019t claim it won\u2019t ever give erroneous code. But, the developers of PHPbot work hard to fix all errors, so it\u2019s <strong>getting more reliable with each passing month<\/strong>.<\/p>\n<p>Anyone brand new to PHP will also find this bot useful for <strong>studying code snippets<\/strong>. Once you get <a href=\"https:\/\/www.hongkiat.com\/blog\/osx-apache-mysql-php-part-1\/\">PHP installed locally<\/a>, you can build your own applications and test fast with the PHPbot snippets.<\/p>\n<p>This thing is definitely worth bookmarking and testing with PHP functions that you don\u2019t understand or just can\u2019t memorize.<\/p>\n<p>Also if you have any questions, bug reports or suggestions for improvements drop a message to the official Twitter account <a href=\"https:\/\/twitter.com\/phpbotapp\" target=\"_blank\">@phpbotapp<\/a>.<\/p>\n<p class=\"note\"><strong>Read Also:<\/strong> <a target=\"_blank\" href=\"https:\/\/www.hongkiat.com\/blog\/automated-php-test\/\">10 Best Automated Testing Frameworks For PHP<\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>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&hellip;<\/p>\n","protected":false},"author":18,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3393],"tags":[1319,511],"topic":[4520],"class_list":["entry-content","is-maxi"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v22.8 (Yoast SEO v27.5) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Automate Your PHP Coding with PHPbot - Hongkiat<\/title>\n<meta name=\"description\" content=\"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\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.hongkiat.com\/blog\/automate-php-coding-phpbot\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Automate Your PHP Coding with PHPbot\" \/>\n<meta property=\"og:description\" content=\"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\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.hongkiat.com\/blog\/automate-php-coding-phpbot\/\" \/>\n<meta property=\"og:site_name\" content=\"Hongkiat\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/hongkiatcom\" \/>\n<meta property=\"article:published_time\" content=\"2017-11-09T13:01:32+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/assets.hongkiat.com\/uploads\/automate-php-coding-phpbot\/01-phpbot-webpage-header.jpg\" \/>\n<meta name=\"author\" content=\"Jake Rocheleau\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@hongkiat\" \/>\n<meta name=\"twitter:site\" content=\"@hongkiat\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jake Rocheleau\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/automate-php-coding-phpbot\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/automate-php-coding-phpbot\\\/\"},\"author\":{\"name\":\"Jake Rocheleau\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/person\\\/966b2daea15283b4145e71aa98a82c2a\"},\"headline\":\"Automate Your PHP Coding with PHPbot\",\"datePublished\":\"2017-11-09T13:01:32+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/automate-php-coding-phpbot\\\/\"},\"wordCount\":314,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/automate-php-coding-phpbot\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/automate-php-coding-phpbot\\\/01-phpbot-webpage-header.jpg\",\"keywords\":[\"PHP\",\"Web Developers\"],\"articleSection\":[\"Toolkit\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/automate-php-coding-phpbot\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/automate-php-coding-phpbot\\\/\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/automate-php-coding-phpbot\\\/\",\"name\":\"Automate Your PHP Coding with PHPbot - Hongkiat\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/automate-php-coding-phpbot\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/automate-php-coding-phpbot\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/automate-php-coding-phpbot\\\/01-phpbot-webpage-header.jpg\",\"datePublished\":\"2017-11-09T13:01:32+00:00\",\"description\":\"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\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/automate-php-coding-phpbot\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/automate-php-coding-phpbot\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/automate-php-coding-phpbot\\\/#primaryimage\",\"url\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/automate-php-coding-phpbot\\\/01-phpbot-webpage-header.jpg\",\"contentUrl\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/automate-php-coding-phpbot\\\/01-phpbot-webpage-header.jpg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/automate-php-coding-phpbot\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Automate Your PHP Coding with PHPbot\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\",\"name\":\"Hongkiat\",\"description\":\"Tech and Design Tips\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\",\"name\":\"Hongkiat.com\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wp-content\\\/uploads\\\/hkdc-logo-rect-yoast.jpg\",\"contentUrl\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wp-content\\\/uploads\\\/hkdc-logo-rect-yoast.jpg\",\"width\":1200,\"height\":799,\"caption\":\"Hongkiat.com\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/hongkiatcom\",\"https:\\\/\\\/x.com\\\/hongkiat\",\"https:\\\/\\\/www.pinterest.com\\\/hongkiat\\\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/person\\\/966b2daea15283b4145e71aa98a82c2a\",\"name\":\"Jake Rocheleau\",\"description\":\"Jake is a writer and designer with over 10 years experience working on the web. He writes about user experience design and cool resources for designers\",\"sameAs\":[\"https:\\\/\\\/www.hongkiat.com\"],\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/author\\\/jake\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Automate Your PHP Coding with PHPbot - Hongkiat","description":"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","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.hongkiat.com\/blog\/automate-php-coding-phpbot\/","og_locale":"en_US","og_type":"article","og_title":"Automate Your PHP Coding with PHPbot","og_description":"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","og_url":"https:\/\/www.hongkiat.com\/blog\/automate-php-coding-phpbot\/","og_site_name":"Hongkiat","article_publisher":"https:\/\/www.facebook.com\/hongkiatcom","article_published_time":"2017-11-09T13:01:32+00:00","og_image":[{"url":"https:\/\/assets.hongkiat.com\/uploads\/automate-php-coding-phpbot\/01-phpbot-webpage-header.jpg","type":"","width":"","height":""}],"author":"Jake Rocheleau","twitter_card":"summary_large_image","twitter_creator":"@hongkiat","twitter_site":"@hongkiat","twitter_misc":{"Written by":"Jake Rocheleau","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.hongkiat.com\/blog\/automate-php-coding-phpbot\/#article","isPartOf":{"@id":"https:\/\/www.hongkiat.com\/blog\/automate-php-coding-phpbot\/"},"author":{"name":"Jake Rocheleau","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/person\/966b2daea15283b4145e71aa98a82c2a"},"headline":"Automate Your PHP Coding with PHPbot","datePublished":"2017-11-09T13:01:32+00:00","mainEntityOfPage":{"@id":"https:\/\/www.hongkiat.com\/blog\/automate-php-coding-phpbot\/"},"wordCount":314,"commentCount":0,"publisher":{"@id":"https:\/\/www.hongkiat.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.hongkiat.com\/blog\/automate-php-coding-phpbot\/#primaryimage"},"thumbnailUrl":"https:\/\/assets.hongkiat.com\/uploads\/automate-php-coding-phpbot\/01-phpbot-webpage-header.jpg","keywords":["PHP","Web Developers"],"articleSection":["Toolkit"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.hongkiat.com\/blog\/automate-php-coding-phpbot\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.hongkiat.com\/blog\/automate-php-coding-phpbot\/","url":"https:\/\/www.hongkiat.com\/blog\/automate-php-coding-phpbot\/","name":"Automate Your PHP Coding with PHPbot - Hongkiat","isPartOf":{"@id":"https:\/\/www.hongkiat.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.hongkiat.com\/blog\/automate-php-coding-phpbot\/#primaryimage"},"image":{"@id":"https:\/\/www.hongkiat.com\/blog\/automate-php-coding-phpbot\/#primaryimage"},"thumbnailUrl":"https:\/\/assets.hongkiat.com\/uploads\/automate-php-coding-phpbot\/01-phpbot-webpage-header.jpg","datePublished":"2017-11-09T13:01:32+00:00","description":"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","breadcrumb":{"@id":"https:\/\/www.hongkiat.com\/blog\/automate-php-coding-phpbot\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.hongkiat.com\/blog\/automate-php-coding-phpbot\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.hongkiat.com\/blog\/automate-php-coding-phpbot\/#primaryimage","url":"https:\/\/assets.hongkiat.com\/uploads\/automate-php-coding-phpbot\/01-phpbot-webpage-header.jpg","contentUrl":"https:\/\/assets.hongkiat.com\/uploads\/automate-php-coding-phpbot\/01-phpbot-webpage-header.jpg"},{"@type":"BreadcrumbList","@id":"https:\/\/www.hongkiat.com\/blog\/automate-php-coding-phpbot\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.hongkiat.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Automate Your PHP Coding with PHPbot"}]},{"@type":"WebSite","@id":"https:\/\/www.hongkiat.com\/blog\/#website","url":"https:\/\/www.hongkiat.com\/blog\/","name":"Hongkiat","description":"Tech and Design Tips","publisher":{"@id":"https:\/\/www.hongkiat.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.hongkiat.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.hongkiat.com\/blog\/#organization","name":"Hongkiat.com","url":"https:\/\/www.hongkiat.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.hongkiat.com\/blog\/wp-content\/uploads\/hkdc-logo-rect-yoast.jpg","contentUrl":"https:\/\/www.hongkiat.com\/blog\/wp-content\/uploads\/hkdc-logo-rect-yoast.jpg","width":1200,"height":799,"caption":"Hongkiat.com"},"image":{"@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/hongkiatcom","https:\/\/x.com\/hongkiat","https:\/\/www.pinterest.com\/hongkiat\/"]},{"@type":"Person","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/person\/966b2daea15283b4145e71aa98a82c2a","name":"Jake Rocheleau","description":"Jake is a writer and designer with over 10 years experience working on the web. He writes about user experience design and cool resources for designers","sameAs":["https:\/\/www.hongkiat.com"],"url":"https:\/\/www.hongkiat.com\/blog\/author\/jake\/"}]}},"jetpack_featured_media_url":"https:\/\/","jetpack_shortlink":"https:\/\/wp.me\/p4uxU-ag9","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/39441","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/users\/18"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/comments?post=39441"}],"version-history":[{"count":1,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/39441\/revisions"}],"predecessor-version":[{"id":39442,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/39441\/revisions\/39442"}],"wp:attachment":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/media?parent=39441"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/categories?post=39441"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/tags?post=39441"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/topic?post=39441"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}