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

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/

NetTuts.com:
Build a Real-Time Chat Application With Modulus and Laravel 5
Sep 02, 2015 @ 10: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 @ 10: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 @ 10: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

Robert Basic's Blog:
Creating a chat bot with PHP and Dbus
Jan 09, 2012 @ 11: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:

Michael Feichtinger's Blog:
PHP5 WebSocket Example - A Simple Chat
Feb 03, 2011 @ 09:47:28

Michael Feichtinger has posted a simple websocket example to his blog today. It shows the creation of a simple "web chat" application for real-time communication without the mess that can come with ajax.

The classic example for websockets is a chat. This chat example has only 200 lines of code (excl. the Websocket class), is really easy to understand and customizable.

He creates a basic "WebsocketClass" class that (in his example) connects to an IP and port. It uses JSON as the messaging format and some basic javascript to handle the clicks of the "chat" and "login" buttons. You can see an example in action here and download the source for the server.php here.

tagged: websocket exmaple tutorial chat realtime json javascript

Link:

Abhinav Singh's Blog:
Writing your first facebook chat bot in PHP using Jaxl library
Feb 12, 2010 @ 09:16:04

With the announcement Facebook as made about opening up their chat service to outside connections, several developers are taking the opportunity to create their own scripts to interface with the service. One developer, Abhinav Singh has posted a tutorial about the sample application he's created to do just that.

Today facebook officially announced availability of it’s chat through jabber/xmpp clients. This is a big win for XMPP, with almost 400 million new probable users adding into XMPP club. In this post, I will demonstrate how to connect to facebook chat servers using Jaxl client library in PHP. It can further be used to make custom chat bots for facebook.

He shows how to use the Jaxl library to make the connection, setting up some basic environment variables and making the connection to the server. The index.php file that comes with the library reads this config file and sends a default message to the server and returns the response.

tagged: facebook chat connection jaxl library

Link:

NETTUTS.com:
How to Create A Simple Web-based Chat Application
Jul 27, 2009 @ 08:12:55

From NETTUTS.com there's a new tutorial they've posted showing you how to create a simple web-based chat application (real-time, not like twitter) with equal parts PHP and jQuery.

In this tutorial we will be creating a simple web-based chat application with PHP and jQuery. This sort of utility would be perfect for a live support system for your website.

Full code is provided, both in the post and available for download, and the end result will look something like this. Messages are just stored in a file on the backend, but it could be easily modified to use something like MySQL to keep track of the messages for that session.

tagged: webbased chat application jquery tutorial

Link:

Lukas Smith's Blog:
Chatting with Rasmus (part two and three)
Apr 04, 2008 @ 10:37:12

Lukas Smith has posted the second and third parts of his talk with Rasmus Lerdorf - a look at MaxClients and HTTP headers.

As promised here are the two other logs from the recent chat I witnessed. [...] Again I left the logs in their raw original way. Hope they are useful for you all.

Lukas also links to two resources he mentions in the second (third?) log about performance as well as mentioning one of the most useful Firefox extensions for web developers - YSlow!.

tagged: lukassmith rasmuslerdorf chat http header maxclient

Link:

Lukas Smith's Blog:
Chatting with Rasmus (part one)
Mar 31, 2008 @ 13:58:08

Lukas Smith got a chance to catch up with Rasmus Lerdorf (and others in #php.pecl) and "talk shop" about topics including handling large libraries and maxclients settings.

In this first post I will provide a link and some commentary on Rasmus's points regarding Doctrine (note I left independent chatter in the log in order to not have any chance of me filtering the content, but there is very little of that so I hope the discussion is still easy enough to follow).

  • Lukas introduces Doctrine briefly (what it does) along with some general thoughts on ORMs and making code a bit more bye code cache friendly.

  • tagged: rasmuslerdorf chat doctrine orm suggestion bytecode cache

    Link: