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

TutsPlus.com:
Get Started With Pusher: Build a Chat App With Channels, PHP, and Vue.js
Aug 02, 2018 @ 19:19:09

On the TutsPlus.com site they've posted a tutorial that, making use of the Pusher service, walks you through the process of creating a multi-channel chat application using it, PHP and Vue.js.

In this post, I'll show you how to write the functional components of a very simple chat app. It's a stripped-down example, but you'll see how Channels can simplify the implementation of real-time communication in a web app.

While the post does include a screencast of the process, it also walks through it in a text format, helping you:

  • set up the server with the Pusher PHP package
  • create the client code on the backend and frontend
  • send messages between the chat windows

The Channels functionality makes it simple to subscribe and see only the messages you want (and not everything that comes down the line). The Pusher PHP library makes the integration simple too.

tagged: tutorial pusher chat application channels vuejs

Link: https://code.tutsplus.com/tutorials/get-started-with-pusher-build-a-chat-app-with-channels-php-and-vuejs--cms-31252

Twilio Blog:
Laravel and Twilio: Group Video Chat
Sep 27, 2017 @ 16:55:01

The Twilio blog has a new post from PHP developer advocate Margaret Staples showing you how to integrate Twilio and Laravel to create a group video chat system. This makes use of the Twilio Video API to build the connections between users via a Laravel application.

While words alone are powerful, the inflections of people’s voices, the gestures and expressions we unconsciously flow through during conversation all contain a wealth of information often lost to us in our technology driven communications.

Using Twilio’s Video API you can now add the richness of face to face interactions to any web project.

Here we’ll look at how to create a Laravel web application that gives users the ability to join existing video groups or create their own. You can preview what we’re building here.

The tutorial starts with a few assumptions (things you'll need to have already set up) and a link to a GitHub repository that provides some of the boilerplate code. After a few setup commands the application should be ready to add the Twilio API/account configuration values and the addition of three routes for room joins, creates and listing. Next she creates the controller to handle the incoming requests and the views for the page output including the video and audio service provided by a Twilio script. Finally they show how to demo the result and include a few troubleshooting steps you can follow if something seems to be going wrong.

tagged: twilio laravel video chat tutorial room multiuser

Link: https://www.twilio.com/blog/2017/09/laravel-and-twilio-group-video-chat.html

Sergey Zhuk:
Build A Simple Chat With ReactPHP Socket: Server
Jun 28, 2017 @ 15:46:39

Sergey Zhuk has a new post to his site showing how you can use ReactPHP's socket component to build a simple chat service as a server runing on a remote port.

In this article, we are going to build a simple chat server based on ReactPHP Socket Component. With this component, we can build simple async, streaming plaintext TCP/IP or a secure TLS socket server.

There are client and server sockets. The server is bound to a specific port number and just waits listening on this port. The client knows the host of the server and the port on which the server is listening. When the connection between server and client is established, the data exchange begins.

He then gets into the code required to make the server and add in some additional functionality. He starts by creating the server to listen for incoming connections and has it write back a simple message to prove it's working correctly. He then moves on to the code required for sending and receiving data. This initial version just echoes back what the user submits. He takes this an expands it out to start on the intiial steps of the chat system - creating the connection pool for multiple clients, storing usernames of those connected and using that information when transmitting a message to all clients connected.

tagged: simple reactphp chat server tutorial server client username

Link: http://seregazhuk.github.io/2017/06/22/reactphp-chat-server/

TNT Studio:
Easy way of sending scheduled tasks output to Slack
Jul 06, 2016 @ 16: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

SitePont PHP Blog:
How to Quickly Build a Chat App with Ratchet
Sep 28, 2015 @ 15:52:41

On the SitePoint PHP blog they've posted a tutorial showing you how to build a chat application with Ratchet, a library in PHP that lets you work with WebSockets for more real-time communication between your frontend and backend systems.

In this tutorial, we’ll be taking a look at Ratchet, a PHP library for working with WebSockets. Let’s start by defining what WebSockets are. MDN says: "WebSockets is an advanced technology that makes it possible to open an interactive communication session between the user’s browser and a server. With this API, you can send messages to a server and receive event-driven responses without having to poll the server for a reply. Connected computers image."

WebSockets allow us to write applications that can pass data from the browser to the server and vice-versa in real-time.

They start by helping you get Ratchet installed (via Composer) and start immediate in on the code. They create the application namespace, a Chat class and client to handle the WebSocket connection. They create methods for the open, close, write and read for the connection and make a simple script with a Ratchet server to handle the messaging back and forth. They also explain the various pieces of the system: the IoServer, HttpServer and WsServer. Finally they help you create the HTML frontend (using jQuery and Handlebars) and the CSS/Javascript to finish off the functionality.

tagged: ratchet websocket realtime chat application tutorial library

Link: http://www.sitepoint.com/how-to-quickly-build-a-chat-app-with-ratchet/

Pusher Blog:
How to Build Real-Time Laravel Apps with Pusher
Sep 23, 2015 @ 15:22:31

The Pusher blog has posted the set of tutorials they created as a part of the Laracon EU conference that shows you how to use their service to create a real-time Laravel-based application - a simple chat application.

The Laravel framework and Pusher are a great combination. Laravel helps you build elegant applications and at warp speed; Pusher helps you add real-time features to those apps in a fraction of the time it would take to build using your own infrastructure. [...] We recently wrote a set of tutorials covering How to Build Real-Time Laravel Apps with Pusher as part of a Workshop for Laracon EU. We’ve now opened up these tutorials for everybody and anybody to work through. The source has been opened up under the Commons Attribution 4.0 International License so you’re free to fork and adapt to suit your needs or even to run your own workshop.

The talk briefly about who the tutorials are targeted at and how the guide is laid out (a Gitbook). It covers some of the fundamentals of Pusher, setting it up via a Laravel bridge, debugging tips and the construction of the actual sample application.

tagged: pusher realtime application tutorial series gitbook chat laravel

Link: https://blog.pusher.com/how-to-build-real-time-laravel-apps-with-pusher/

SitePoint PHP Blog:
Logging with Monolog: From Devtools to Slack
Sep 02, 2015 @ 16: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/

NetTuts.com:
Build a Real-Time Chat Application With Modulus and Laravel 5
Sep 02, 2015 @ 15:17:16

On NetTuts.com they've posted a tutorial showing you how to create a real-time chat system using Laravel 5, Modulus and Pusher (with a PostregSQL backend).

In this tutorial, I will show you how to implement a real-time chat application with Laravel 5, PostgreSQL, and Pusher. Then we will deploy this application to Modulus together. We will use Laravel 5 for the back-end service, HTML5 and jQuery for a simple front-end application, PostgreSQL for the database, and Pusher for real-time communication between the server and clients.

They start with the scenario they want to solve and a look at the overall architecture of the solution. Then they start setting up the software and services needed to bring it all together:

  • installing a fresh copy of Laravel (as a project)
  • setting up a new database using the ElephantSQL service
  • creating a Pusher account and the credentials you'll need for the application
  • creating an Nginx configuration for the Modulus setup

Next comes the design of the application, creating the models for message data (author, content, etc) and the simple controller to handle the requests. They show how to configure the connection to Pusher and build the routes for getting, listing and saving messages. Finally they create the view complete with Javascript to connect it to Pusher and transfer messages back and forth. All that's left then is the deployment using the modulus command line tool (installed via npm).

tagged: realtime chat tutorial application laravel5 pusher postgresql modulus

Link: http://code.tutsplus.com/tutorials/build-a-real-time-chat-application-with-modulus-and-laravel-5--cms-24284

SitePoint PHP Blog:
Talk PHP with the Experts: The Transcript
Oct 16, 2013 @ 15:43:07

SitePoint had another "Talk with the Experts" session with two of their own developers, Jude Aakjaer and Michael Sauter. They've posted the full transcript of the session to their PHP blog today. It was a Q&A session between them and the attendees.

Topics discussed included:

  • What beginners should know about PHP
  • Most used frameworks
  • Using WordPress
  • Tools/IDEs the two developers like
  • Packagist/Composer
  • Using 3rd party libraries
  • Naming conventions and namespacing

You can read the full discussion here.

tagged: experts talk transcript questions answers chat

Link: http://www.sitepoint.com/talk-php-expertsthe-transcript/

Saran Chamling:
Simple Chat Using WebSocket and PHP Socket
Jul 30, 2013 @ 15:38:41

While not a recent article, this post from Saran Chamling is definitely interesting. In it he shows you how to create a real-time chat by combining PHP and WebSockets.

The WebSocket is a feature of HTML5 for establishing a socket connections between a web browser and a server, once the connection has been established with the server, all WebSocket data (frames) are sent directly over a socket rather than usual HTTP response and requests, giving us much faster and persistent communication between a web browser and a server. Let’s create a simple chat system using this cool technology (HTML5 WebSocket and PHP).

He includes all the code you'll need to get things up and running, starting from the WebSocket side. With a simple socket connection and some jQuery to control it, the system connects to the backend PHP script. The PHP script reads directly from the socket (using the socket_* functions) and binds to it, waiting for incoming requests. There's also some sample code showing how to work with the "handshake" between the WebSocket and PHP and how to respond. If you want something a bit easier to work with and more functional, consider checking out Ratchet, a WebSocket server for PHP.

tagged: websocket realtime tutorial chat socket

Link: http://www.saaraan.com/2013/05/chat-using-websocket-php-socket


Trending Topics: