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

TutsPlus.com:
Notifications in Laravel
Apr 24, 2018 @ 18:25:24

On the TutsPlus.com site they've posted a new tutorial for the Laravel users out there showing how to work with notifications, a feature build into the framework to make it simpler to provide information to users when certain events are triggered.

In this article, we're going to explore the notification system in the Laravel web framework. The notification system in Laravel allows you to send notifications to users over different channels. Today, we'll discuss how you can send notifications over the mail channel.

The tutorial starts with some of the basics of the notification system including a mention of the other methods (like SMS and Slack) and storing them in a database for other interaction. It then moves on to the creation of a Messages model and a custom notification class to send email to a when a new message is sent from another user. With the class created, they move into the process required to send the notification using the Notification::send method.

tagged: laravel tutorial notification email custom message

Link: https://code.tutsplus.com/tutorials/notifications-in-laravel--cms-30499

Laravel News:
Real-time messaging with Nexmo and Laravel
Mar 05, 2018 @ 16:28:04

The Laravel News site has posted the third part of their series about the construction of helpdesk software. In this latest article they integrate Nexmo for real-time messaging using Nexmo Stitch.

Welcome back to the third and final (for now!) part of the Deskmo series. In Part 2 added support for voice calls, with text-to-speech and transcription support.

Today, we’re going to add in-app messaging using Nexmo Stitch. Stitch takes care of all of the heavy lifting for real-time chat, providing you with a websocket that you connect to and listen for events relating to your application.

The article starts by listing out some prerequisites (a Nexmo client account and the Deskmo project) as well as an installation of the Nexmo Stitch command-line client. It then walks you through the process of setting up a Nexmo user profile for each user in the helpdesk software and updating the database with this new information. It then shows how to add in-app notification messaging and linking the messages and tickets together with a conversation ID. With Stitch installed you can then create the chat interface and link the backend to the Nexmo service as a user easily sending and receiving messages.

tagged: realtime message laravel nexmo helpdesk tutorial series part3

Link: https://laravel-news.com/real-time-messaging-nexmo-laravel

Sebastian De Deyne:
Debugging the dreaded "Class log does not exist" error in Laravel
Oct 26, 2017 @ 14:57:03

Sebastian De Deyne has a post to his site that shares some hints on how to track down the dreaded "class log does not exist" error in Laravel-based applications.

Every now and then I come across a Class log does not exist exception in Laravel. This particular exception is thrown when something goes wrong really early in the application, before the exception handler is instantiated.

Whenever I come across this issue I'm stumped. Mostly it's related to an invalid configuration issue or an early service provider that throws an exception. I always forget how to debug this, so it's time to document my solution for tracking down the underlying error.

As Laravel hides the real issue behind an error thrown from the logging class, it's difficult to determine where the problem actually lies. The path to solve this and get to the actual error involves a change to the handle method and using the die method to output both the message and stack trace of the issue before Laravel can try to handle it. Obviously this is only really meant for debugging but can be handy when this error is hiding the real reason for the failure.

tagged: laravel error message exception logger classlog exist tutorial

Link: https://sebastiandedeyne.com/posts/2017/debugging-the-dreaded-class-log-does-not-exist-error-in-laravel

BitExpert Blog:
Mattermost Webhooks and PHP
Jul 19, 2017 @ 15:49:26

On the BitExpert blog Stephan Hochdörfer shares his experience working with Mattermost webhooks and interfacing them with backend PHP scripts. Mattermost is an Open Source Slack clone.

In a recent attempt to automate a few things even more, I was looking for a way to post messages to our [Mattermost](http://mattermost.org/) instance via the [Incoming Webhook](https://docs.mattermost.com/developer/webhooks-incoming.html) feature of Mattermost. I did a quick search on [Packagist](https://packagist.org/search/?q=mattermost) for Mattermost client libraries and as it turns out there a quite a few. I picked the [thibaud-dauce/mattermost-php](https://packagist.org/packages/thibaud-dauce/mattermost-php) package simply because it was the first match.

He then walks through the installation of the package and how it works, using Guzzle, to send messages to the Mattermost service. The incoming request is just a JSON-formatted data set, so it's easily parsed in plain PHP. The output, however, needs to be in a format Mattermost understands. That's where the package comes in, providing a "send" method that allows for the customized text and optional attachment to be sent to the Mattermost server.

tagged: mattermost package webhook messaging message tutorial

Link: https://blog.bitexpert.de/blog/mattermost-webhooks-and-php/

NetTuts.com:
CodeIgniter Form Validation: From Start to Finish
Jul 06, 2017 @ 15:53:12

The NetTuts.com site has a new tutorial posted covering form validation in CodeIgniter "from start to finish" showing you how to use the built-in functionality to verify the information coming from your users.

As a web application developer, form validation is a crucial part of your work, and it should not be underrated as it could lead to security flaws in your application. You should consider it a must if you're striving to provide a professional end user experience.

In this article, we'll go through the built-in form validation library in the CodeIgniter framework. Here are the highlights of today's article: [The use of ] basic form validation, cascading and prepping, custom error messages, custom validation callback, and validation configuration

They start off by covering some of the basic included rules using a simple controller and view. These checks include values being required, maximum length of text, alphanumeric only, valid email and checking that the value is a valid IPv4 address. The example also shows how to make use of the "cascading" rules and using the rules system to "prep" the data first. They walk through each line of the code that defines the rules talking about what it does and how they can be adjusted to fit your needs. They cover more in-depth how cascading and prepping work, how to customize error messages and create custom callback validation rules you can apply along with the standard ones.

tagged: codeigniter tutorial validation introduction cascade prep data custom message

Link: https://code.tutsplus.com/tutorials/codeigniter-form-validation-from-start-to-finish--cms-28768

Derick Rethans:
Not Finding the Symbols
Dec 01, 2016 @ 15:58:22

In this new post to his site Derick Rethans about an issue that was discovered with the newer version of the PHP MongoDB driver dealing a JSON encoding/decoding error.

Yesterday we released the new version of the MongoDB Driver for PHP, to coincide with the release of MongoDB 3.4. Not long after that, we received an issue through GitHub titled "Undefined Symbol php_json_serializable_ce in Unknown on Line 0".

The driver makes use of the JSON extension's "JsonSerializable" interface to handle some of the BSON types (like binary data). They were surprised that, despite running their tests on a wide range of builds they never came up with this same issue, compiling them from source. The key here is that the JSON extension is bundled along with the binary when compiled this way however some linux distributions do things differently. They ship it as a separate module and, because this could potentially be missing, a JSON error like the one reported could occur. He goes on to talk about some specific examples from various distributions and the simple fix - ensure the JSON extension is loaded before the MongoDB driver is loaded in your installation. This prevents the JSON handling from being missing and the JSON-related error message from popping up.

tagged: mongodb driver undefined symbol error message extension troubleshoot

Link: https://derickrethans.nl/undefined-symbol.html

Scotch.io:
Handling Laravel Validation Error Messages With Vue.js
Nov 02, 2016 @ 15:32:28

The Scotch.io blog has posted a new tutorial for the Laravel+Vue.js users out there helping you effectively handle validation error messages output through the Vue.js portion of the application.

Recently, I launched a open source side project I was working on called Open Laravel. Open Laravel allows developers to submit open source projects that were built using the Laravel framework. The project submission page uses Vue.js to submit the form asynchronously through an AJAX request. Since I am no longer sending the form the default way (refreshing after form submission), I needed a way to show Laravel form validation error messages. After going back and forth with some forum questions and answers, I was able to make it work.

The tutorial starts you out with a fresh install of Laravel and runs a npm install to get the Laravel Elixir dependencies. They then add in the other dependencies (like Vue.js itself and the use-resource package). Next up are changes on the Laravel side: adding required routes, setting up a "Posts" controller and making a simple view with the form to take in post content. They provide the Javascript for the Vue.js side as well, making use of the vue-resource to connect the form with the POST request to the backend. Finally they tie in the "FormError" component and have it either show failure messages or success messages when everything's good.

tagged: tutorial vuejs laravel form submit vueresoruce error message

Link: https://scotch.io/tutorials/handling-laravel-validation-error-messages-with-vue-js

TutsPlus.com:
Building Your Startup: Notifying People of Meeting Updates
Oct 24, 2016 @ 15:37:50

On TutsPlus.com they've continued their series showing the construction of a startup (a calendaring site) using PHP and the Yii2 framework. In this latest article they walk you through their construction of a notification system when others need to be informed/invited to meetings in the system.

This tutorial is part of the Building Your Startup With PHP series on Envato Tuts+. In this series, I'm guiding you through launching a startup from concept to reality using my Meeting Planner app as a real-life example. [...] In this two-part series, I'll describe how we built the notifications infrastructure and their delivery. Today, I'm going to focus on the MeetingLog to track changes that help us determine when to send updates.

They start with their vision of how the notification system should work (starting at the UI level) and the types of responses an invited user could reply with. The article then gets into how the notifications will work and the creation of the first step: a log to track all actions taken around notifications. They include the model to work with the logging table, adding a new log message, defining the logging command and finding specific log messages. With that in place, the tutorial switches to the frontend, showing what the notifications should look like using flash messages and a few updates to the views in the application.

tagged: startup build tutorial series log message yii2 framework

Link: https://code.tutsplus.com/tutorials/building-your-startup-notifying-people-of-meeting-updates--cms-26594

Laravel News:
Sending and Receiving SMS with Laravel and Nexmo
Aug 05, 2016 @ 17:36:05

On the Laravel News site they've posted a tutorial from Phil Leggetter showing you how to integrate your application with Nexmo to be able to send and receive SMS messages in your Laravel application.

In this quick tutorial by Phil Leggetter, we’ll cover how you can both send and receive SMS from your Laravel application. We’ll do this using Nexmo, a cloud communications platform that offers APIs for provisioning phone numbers, sending and receiving SMS (which is handy since we’ll use that), making and receiving phone calls and more.

He starts off with some prerequisites you'll need to get the system working (including an account on Nexmo and their command line tool). They create a fresh Laravel application and integrate the Nexmo PHP package into it as a service provider. With that installed he shows how to send an SMS message to a phone number, how to "rent" a number they can reply to and receiving the callback when they send a response. The post finishes with the setup of an "auto-responder" that just confirms that the message was received.

tagged: nexmo laravel tutorial integration send receive message rent number

Link: https://laravel-news.com/2016/08/sending-receiving-sms-laravel-nexmo/

Christian Weiske:
PHP: Allowed memory size exhausted
Jul 12, 2016 @ 17:17:20

Christian Weiske has a post to his site with a reminder about a common misconception that can happen because of the wording in a standard PHP message about memory exhaustion.

The indieweb.org wiki has a page about Wordpress with a Criticism section. ?

One of those "issues" listed is Fatal Error memory exhausted [...but] I removed that section because it's nonsense to list a server configuration issue as Criticism.

While the admins reverted the change to put the message back, Christian clarified what meaning of the error message to help clarify the situation. In the case if the example message, the "32 bytes" it mentions is not the amount of total memory it's trying to allocate, it's the amount it last tried and failed at. Christian also points out the role that PHP's own memory_limit setting has on when this message might pop up.

tagged: allowed memory size exhausted error message clarification

Link: http://cweiske.de/tagebuch/php-memory-exhausted.htm


Trending Topics: