Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Freek van Der Herten:
Automatically close stale issues and pull requests
May 02, 2018 @ 14:31:17

In a post to his site Freek van Der Herten shares some functionality that Spatie uses to help keep the stale pull requests under control across their 180+ repositories: a Botman-based bot that assesses the last updated date and closes after a given amount of time.

At Spatie we have over 180 public repositories. Some of our packages have become quite popular. We're very grateful that many of our users open up issues and PRs to ask questions, notify us of problems and try to solve those problems, ...

Most of these issues and PRs are handled by our team. But sometimes those issues and PRs become stale. [...] That's why we created a bot that can automatically close stale issues and PRs. Here's [an example] of the bot in action.

He then shares the code they currently use for the bot, making use of the BotMan package as a base and the knp-labs/github-api package for the GitHub interaction. The code includes the GitHub service provider, a client class, an Issue object and the command that's run to find and close out the stale pull requests and issues.

tagged: stale pullrequest issue github automatically close bot botman tutorial

Link: https://murze.be/automatically-close-stale-issues-and-pull-requests

Scotch.io:
Build A Telegram Bot with Laravel and BotMan
Mar 07, 2018 @ 16:17:49

On the Scotch.io site there's a tutorial posted showing you how to create a Telegram bot with BotMan the popular PHP package for creating chatbots.

Being a Scotch.io reader you definitely know that we have covered creating Bots before, we have quite few posts on Slack Bots, Twitter Bots and other related topics [...] But today, we have something different for you, today we will be creating a Telegram bot for dog lovers. Yes, you heard it right. A Telegram Bot for dog lovers using Dog API.

The tutorial then walks through the entire process of getting the bot up and running including:

  • Installation of Laravel and BotMan
  • Creating the commands and testing the bot
  • Installing the Telegram driver and creating the bot
  • Using ngrok to allow external calls to come into your internal application

The post finishes by showing how to link your bot to Telegram and test it out using messages to send you random dog pictures when requested.

tagged: scotchio telegram bot botman tutorial setup configure connect

Link: https://scotch.io/tutorials/build-a-telegram-bot-with-laravel-and-botman

TutsPlus.com:
Using the Twitter API to Tweet Repetitive Content
May 03, 2017 @ 14:58:18

On the TutsPlus.com site they've continued their series covering the use of the Twitter API from PHP. In this latest tutorial author Jeff Reifman shows you how to use the API to tweet content repetitively at different intervals and with randomized content. The tutorial uses a Yii2 framework application as its base.

Welcome back to our coverage of the Twitter API. If you use Twitter, you may have come across a friend sharing tweets from the @infinite_scream bot (shown above). I know it's mostly a bot because it tweets at ten-minute intervals. But it varies the string length of its virtual screams to avoid being blocked by the Twitter's API's infamous undocumented restrictions. Tweet too frequently or repeat the same content and you'll find your bots hopelessly blocked.

Recently, an online friend asked me to help them write code for a bot that might repeat but provide some intelligent content variation. In today's tutorial, I'll write about how to do this with the Twitter API.

He starts off with the registration of a new Twitter application and the creation of the table to store the tweet variations. Next he uses the CRUD and model generators in Yii2 to build out the model and controller skeletons. He then creates the migrations/tables/models for the random hashtags and URLs the bot will include in its tweets. Finally, he shows the creation of the code to make the random tweets and how he made the choice of when to tweet. The post ends with the code to send off the tweet (the job) and an example of the results.

tagged: twitter api repetitive content tutorial series bot random

Link: https://code.tutsplus.com/tutorials/using-the-twitter-api-to-tweet-repetitive-content--cms-28096

Christoph Rumpel:
Build a Telegram group bot in PHP
Mar 06, 2017 @ 19:48:41

Christoph Rumpel has a tutorial posted on his site showing how to create a Telegram group bot using a bit of PHP and the BotMan library.

Working with Facebook Messengers bots is great, but there is one thing still missing: group bots! This is why we will built a little Telegram bot today and use it inside my FantasticBurger group.

First thing to keep in mind here is that a group chatbot can be very different from a 1:1 conversation chatbot. In groups chatbots are often not a direct conversation partner but more a quiet assistant.

He briefly talks about why he created the bot and how to go and set up your own Telegraph bot with a simple first command. He then walks through the set up of the BotMan library and connecting it back to the Telegraph service (via an API call) and a simple handler that returns a "Hi there" message when the bot hears the string "Hello".

tagged: tutorial telegraph bot botman group facebook

Link: http://christoph-rumpel.com/2017/03/Build-A-Telegram-Group-Bot/

Laravel News:
Build your own Slack Bot with this PHP library
Nov 14, 2016 @ 16:43:22

On the Laravel News site they have a new post introducing a handy library you can use to make your own Slackbot quickly and easily (and in a framework agnostic way).

It seems like everyone is using Slack, from company channels to community groups including one for Laravel.

Bots have been the new rage within the service and if you’d like to build your own Marcel Pociot created a framework agnostic PHP Slackbot library to make this easy.

Bots built with SlackBot can hear things, say things and reply to what they hear. This allows you to create conversational applications the way real human people talk to each other.

The post then walks you through some of the most common operations using the bot including:

  • sending messages to a Slack instance
  • working with "conversations"
  • receiving simpler messages and acting on the contents

They also link to this more extended tutorial from the author of the library showing how to use the library with a simple Laravel application.

tagged: slack bot tutorial slackbot library framework agnostic tutorial introduction

Link: https://laravel-news.com/2016/11/slack-bot/

Cees-Jan Kiewiet:
Phergie Slack setup and configuration
Jan 05, 2016 @ 16:27:28

Cees-Jan Kiewiet has posted a tutorial to his site showing how to connect Phergie to Slack through a custom gateway. Phergie is a popular PHP open source IRC bot project in use in several channels on the Freenode.net IRC network.

Ever since the rise of Slack and the Phergie v3 connecting them has been on my to do list. And while Slack API is the better alternative this was fun nontheless.

He walks you through some of the prerequisites for the setup including a working installation of the Phergie bot (installations instructions not included). From there he helps you make the custom Gateway and make a user for the bot to operate under. He then includes the settings and configuration you'll need to configure on the bot to allow it to join the Slack instance.

tagged: phergie slack configuration setup tutorial bot irc

Link: http://blog.wyrihaximus.net/2016/01/phergie-slack-setup-and-configuration/

Hasin Hayder:
Creating a slack bot using PHP to monitor your envato sales
Oct 05, 2015 @ 15:43:03

Hasin Hayder has posted a tutorial to his site showing you how to create a bot for Slack that will monitor your sales on Envato connected via their API.

Slack is awesome. Slack is the de-facto of modern team communication and I am pretty sure that this is not the first time you’re hearing something like this about slack. But if you’re really never used slack, oh boy, I feel pity for you. Anyway, in this article we’re going to make a slack bot that will monitor the sales in our envato account and notify from time to time as soon as someone purchased an item. Pretty useful, eh?

He shows how to make a new channel in your Slack instance (he uses "#sales") and how to add in a named webhook to connect the bot to. He then generates a token on the Envato service to access their API, giving it the needed permissions. He includes the simple curl-based script to make the request to the Envato API to get the latest results and then turn around and post it back to the Slack channel.

tagged: slack bot envato sales api channel automate tutorial

Link: http://hasin.me/2015/10/05/creating-a-slack-bot-using-php-to-monitor-your-envato-sales/

HHVM Blog:
Faster GitHub Commits
Jul 09, 2014 @ 14:23:19

On the Facebook HHVM blog they talk about an improvement they've made to the project allowing for faster GitHub commits on the project. They've reworked things to move away from a manual process on the popular project and automate as much as possible.

Initially, the entire process was manual. We would curl the pull request and pipe it to git am, then manually prepare the diff for review internally. After it was accepted, we would manually prepare the internal commit to be usable externally by GitHub, then manually build and test the new code, and finally git push. Great scripts by ptarjan and sgolemon to help get and prepare pull requests for review and then prepare the commits for GitHub have alleviated some of this manual process. However, in the end, someone still had to manually build, test and then push the code to the world.

Another feature of this effort is a new cron job (facebook-github-bot) that pushes any internal (approved) HHVM code automatically without having to wait for the manual intervention. It syncs all code since the last push, runs all tests and, assuming all went well, pushes it out to GitHub.

we believe that getting your code into the master branch quickly will hopefully help show how much we appreciate your contributions. Now, if there was only a way we could get your pull requests reviewed faster and more openly…. Hmmm…
tagged: github commit release bot continuous integration

Link: http://hhvm.com/blog/5399/faster-github-commits

Robert Basic's Blog:
Creating a chat bot with PHP and Dbus
Jan 09, 2012 @ 17:10:52

Robert Basic has continued his series looking at using Dbus in PHP with this latest post to his blog - using the foundation he's created before to make a chat bot that will listen and respond to commands on a Jabber network.

Now that we know how to use DBus to communicate with Pidgin from PHP and how to listen to DBus signals, it’s time to put it all together by creating a simple chat bot! Nothing fancy, just a simple script that runs somewhere on some server and, by using a Pidgin account, can respond to some basic queries we send it.

His new code listens for an incoming message on the "PurpleInterface", grabs the name of the sender and calls a "PurpleConvImSend" method with the conversation object and the message to send. You can find the complete source for the project on his github account.

tagged: dbus tutorial pigdin extension pecl chat bot jabber

Link:

Matthew Turland's Blog:
Environmental Awareness Quickie
Jul 28, 2008 @ 12:57:00

Matthew Turland came across someone having an issue running his PHP-based IRC bot (Phergie) an an environment where the exec function wasn't allowed:

This causes a warning in the Quit plugin, which uses exec to automatically detection of the full path to the PHP CLI binary on non-Windows systems that it will later use that path to initiate a new PHP CLI process to "restart" the bot.

It check this setting for the future, it was recommended that he look at the SPL ReflectionFunction class (a part of the Standard PHP Library) that would let him check the disabled status of any PHP function (looking at the result of the isDisabled call).

tagged: spl isdisabled reflection exec irc bot phergie exec

Link:


Trending Topics: