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

CloudWays Blog:
Laravel Notification System On Slack And Email
Jul 27, 2017 @ 15:49:59

On the Cloudways blog Saquib Rizwan has continued the series showing how to use Laravel to build out an application the performs various kinds of notifications. In this latest article Saquib

In my previous articles, I helped you create a Laravel email sending system and a Contact Us form.

In this article, I will highlight another amazing feature of Laravel through a very basic Laravel notification system. Using this system, I will send a notification to the user by sending them an email and integrate Slack to setup the system for sending notifications on a Slack channel.

They start with setting up a new Laravel application, creating a "users" table and setting up the database. These instructions are for the Cloudways service but they give you an idea of what needs to be set up at least. Next is the code to set up the User model and to create a new notification for a "visit" to the page. First up is the email notification then comes the Slack notifications. Both use built-in functionality with the "Notifications" package in the framework to make the sending work.

tagged: tutorial laravel notification email slack introduction

Link: https://www.cloudways.com/blog/laravel-notification-system-on-slack-and-email/

Laravel News:
Build your own Slack Bot with this PHP library
Nov 14, 2016 @ 10: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/

Slack Engineering Blog:
Taking PHP Seriously
Oct 14, 2016 @ 09:16:45

On the Slack Engineering blog there's a new post from one of their engineers talking about a choice the company made about their platform - they decided to take PHP seriously. In this post author Keith Adams talks about why they chose PHP and what kind of experiences they've had with it in their own environment.

Slack uses PHP for most of its server-side application logic, which is an unusual choice these days. Why did we choose to build a new project in this language? Should you?

PHP-the-language has many flaws, which undoubtedly have slowed these efforts down, but PHP-the-environment has virtues which more than compensate for those flaws. And the options for improving on PHP’s language-level flaws are pretty impressive. On the balance, PHP provides better support for building, changing, and operating a successful project than competing environments. I would start a new project in PHP today, with a reservation or two, but zero apologies.

He starts with some background on the history of PHP itself, where the language came from and what kinds of issues it tries to mainly solve. He then gets into some of what he sees are the "virtues of PHP" including the blank slate at the start of every request, one-request-one-process concurrency and the fast programmer workflow. He then gets into the "bad stuff" they've found when working with PHP, things like surprise type conversions, a "failure-oblivious philosophy" and inconsistencies in the standard library. Finally he looks into two options (created by Facebook to improve its use of PHP) - HHVM and the Hack language - and how it was integrated into their environment.

tagged: language slack serverside hhvm hack usage experience

Link: https://slack.engineering/taking-php-seriously-cf7a60065329#.pdj63el96

TNT Studio:
Easy way of sending scheduled tasks output to Slack
Jul 06, 2016 @ 11:20:12

On the TNT Studio site they've posted a tutorial showing you how to automate scheduled tasks and output to Slack, the popular online communication tool (think IRC for the web). They show how to use a simple webhook setup to relay the results of a task back to a given channel.

What many of us grow accustomed to is having cron job output emailed to us in order to see if everything went ok. Laravel's task scheduler also supports emailing output of the commands but if you are like millions of developers out there then you are probably using Slack and it's possible that it crossed your mind that it would be great if we could get output of the cron command sent to Slack. So let's do that.

They then walk you through the setup of the Slack notifier class to send the data to Slack via a Guzzle POSTed request. The next portion puts this code to work and creates the code to execute the command and return the results. The "after" event is then used to make the Slack request and output the results to the waiting channel.

tagged: output slack channel chat cronjob scheduled results output guzzle

Link: http://tnt.studio/blog/task-scheduling-output-to-slack

How to Create a Slack Interface for Your PHP Application
Apr 21, 2016 @ 10:12:04

On the TutsPlus.com site they've posted a tutorial helping you connect your PHP application with Slack allowing for both the sending of content to your Slack channel(s) but also responding to "slash" commands.

If you've been following the development of office communication tools in the past year or so, I'm sure you've heard plenty about Slack. [...] As developers, we are in a good position to jump on the trend and think about ways we can use Slack as a chat-based user interface for our applications.

That's why, in this tutorial, you will learn how to get started with integrating your PHP application to Slack, by making it post messages to a Slack channel and respond to slash commands.

They start with a "bare bones" setup that will get you up and running and sending messages to your Slack instance. Their example takes in a string and sends it along through a custom Slack application. They walk you through the steps to create this application on the Slack side and this example code to make the connection and send the message. The tutorial walks you through all of the provided code and helps you get your OAuth credentials in place to secure the connection.

With this basic functionality in place you can then build on top of it and define "slash" commands that request a URL. Their example "tells a joke" in the channel making the request.

tagged: tutorial slack integration api slash command introduction

Link: http://code.tutsplus.com/tutorials/how-to-create-a-slack-interface-for-your-php-application--cms-25269

Community News:
LaraChat Live, Episode #1
Feb 05, 2016 @ 10:27:11

A new Laravel-centric podcast has started up and has posted its first episode: LaraChat Live. Their first recording if from a Google Hangout of a roundtable with host Shawn Mayzes and several other community members from the LaraChat Slack channel

Larachat Live is a live round table discussion from the Larachat community. We discuss PHP and Laravel as well as various other industry related topics.

This weeks discussion (our first round table) will include introductions from community members and our meet & greet outside of Larachat.co. This weekly round table will also include our discussion on PHPMD and PHPCS.

You can watch this episode either using the in-page video player or directly on YouTube. If you enjoy the show and want to keep up with future episodes, subscribe to their YouTube channel and you'll be notified as new videos are published (and when new shows are coming up).

tagged: video podcast roundtable larachat slack channel ep1

Link: https://www.youtube.com/watch?v=rACXJLMReK0

Cees-Jan Kiewiet:
Phergie Slack setup and configuration
Jan 05, 2016 @ 10: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 @ 10: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/

SitePoint PHP Blog:
Logging with Monolog: From Devtools to Slack
Sep 02, 2015 @ 11:48:15

The SitePoint PHP blog has posted a tutorial showing you how to connect Monolog with Slack, a popular logging tool for PHP and a well-used communication (chat) service for development groups and projects. The basic idea is that, when something goes wrong, it's communicated directly to the chat channel versus just to a log somewhere for later analysis.

Logging is an important part of the app development/maintenance cycle. It’s not just about the data you log, but also about how you do it. In this article, we are going to explore the Monolog package and see how it can help us take advantage of our logs.

They start by helping you get Monolog installed in your project via Composer and how to create their "general" logger. He then explains the use of "handlers" in the Monolog system and how to add them to the logger instance. They also explain Monolog's "bubbling" of messages in a browser/error log example. Next they show how to integrate the SlackHandler into the logger, providing it with an access token, the channel to send to and a name to log in with. The article also shows how to format the message, giving it a bit nicer look than just the standard text error. Finally they touch on preprocessors that can add extra information to the log messages without having to touch every instance where it's used.

tagged: monolog slack integration message error realtime chat introduction

Link: http://www.sitepoint.com/logging-with-monolog-from-devtools-to-slack/

Andrew Johnstone's Blog:
Vagrant, Automating PHP/MySQL Installation with bash/slack
Dec 12, 2011 @ 08:58:08

Andrew Johnstone has a new post to his blog with a look at using Vagrant for continuous deployment of a PHP-based application.

Vagrant is simply a wrapper around Virtualbox headless that allows for provisioning virtual machines with support for puppet, chef-solo, chef, and bash. This allows you to automate the deployment and sandboxing of development sites. Additional base box images can be found at vagrantbox.es.

He walks you through the full process of setting up a first deployment - getting Vagrant installed, updating the config for a squeeze64.box image, configuring a virtualhost on the Apache web server and setting up a "preinstall" script to configure things like MySQL and install a long list of packages (via apt-get).

tagged: continuous deployment vagrant mysql slack bash