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

Pineco.de:
Notify Locked Out Users in Laravel
Jan 07, 2019 @ 19:17:27

On the Pineco.de blog they've posted a tutorial for the Laravel users out there showing how to notify locked out users making use of functionality already included with the framework.

Laravel offers a nice feature, that locks out the users that attempted to login too much. It’s a nice way to prevent brute force logins. But how can we notify the user, when the lockout happens? Maybe it wasn’t the user who attempted to log in.

The tutorial starts with the details on setting up the listener to capture the Lockout event and pass it off to a UserLockedOut class. Once this is created, they show how to use this class and, via the included "notification" system in Laravel, send an email to the user in question with more information about their account being locked.

tagged: laravel tutorial user lockout notification

Link: https://pineco.de/notify-locked-out-users-in-laravel/

Pineco.de:
Subscribing Users to a MailChimp List with Laravel and Guzzle
Oct 08, 2018 @ 20:50:05

On the Pineco.de blog they've posted a tutorial showing how to use Guzzle to subscribe users to a Mailchimp mailing list in a Laravel application. The technique isn't specific to a Laravel application and can be adapted relatively easily for other framework/application types.

Managing users and mailing lists are not a that painful nowadays. Since we have excellent services that can cover all the needs we have, we don’t need to worry about it too much. But still, let’s take a look at how can we handle user subscriptions when Laravel fires different events.

In the tutorial, the request is sent to Mailchimp via the user registration event fired when a new user signs up for the site. They include the code to create the listener and register it in the Laravel configuration. They've also included the code that will be used when the event is fired, sending a message to the Mailchimp API with a "subscribed" status and the user information.

tagged: tutorial subscribe user mailchimp mailinglist laravel guzzle api

Link: https://pineco.de/subscribing-users-to-a-mailchimp-list-with-laravel-and-guzzle/

Laravel News:
Laravel 5.7 Guest User Gates
Sep 06, 2018 @ 15:49:45

On the Laravel News site they highlight a change in the way that the "gates" handling works in the v5.7 release of the popular framework. In this change you can now allow "guest" users into certain parts of your system.

In Laravel 5.6 and below authorization gates and policies automatically return false for unauthenticated users. New in Laravel 5.7, you can now allow guests to go through authorization checks by using a nullable type-hint or setting the default value as null:

[...] By using a nullable type hint the $user variable will be null when a guest user is passed to the gate, and you can then make decisions about authorizing the action. If you allow nullable types and return true, then the guest will have authorization.

The post includes a code snippet showing how to put it to use and the resulting 403 page they would get otherwise. You can find out more about other new features of Laravel v5.7 in this other article.

tagged: laravel gate user tutorial nullable feature framework

Link: https://laravel-news.com/laravel-5-7-guest-user-gates-policies

TutsPlus.com:
Get Started With Pusher: Using Presence Channels
Aug 23, 2018 @ 15:53:56

The TutsPlus.com site has continued their series looking at using the Pusher real-time communication service in your PHP application with a new tutorial. In this latest article, they show the use of presence channels, a feature that makes it simpler to know which users are connected to which channels.

In this series, we've been learning about Channels from Pusher, a platform that allows you to give your users the seamless real-time experience they want.

Presence channels build on the security provided by private channels, but they add the benefit of knowing which users are subscribed and connected to that channel. The best part is how easy it is to implement and use presence channels, and it's even easier if you've already configured your app to use private channels.

As in the previous articles in the series, they've provided both a screencast of the tutorial and the text-based version. They show how to modify the server you've already created to authorize a user and send that information along with the messages back to the Pusher service. They also include the changes to the frontend client to gather and send user information.

tagged: pusher service tutorial channel presence user information realtime

Link: https://code.tutsplus.com/tutorials/get-started-with-pusher-using-presence-channels--cms-31448

Matthias Noback:
Exceptions and talking back to the user
Apr 10, 2018 @ 14:13:25

Matthias Noback has a new post to his site with some suggestions about exception handling and user feedback for both the backend experience and UI side.

Designing domain objects is all about offering meaningful behavior and insights through a carefully designed API. [...] So exceptions in your (object-oriented) domain model are not merely meant to signal an exceptional situation. They can be used to prevent invalid or unsupported usage of an object. By offering well-named methods (with sensible parameters) for changing the object's state, and by being very precise about throwing exceptions when invalid use is imminent, you make your domain objects usable in only one way: the way that makes sense. This is the exact opposite of how your domain objects end up looking if you generate getters and setters for every attribute.

He starts by looking at the use of exceptions to help with validation and a few ways they could be used:

  • Exceptions get thrown ad hoc, whenever something threatens the consistency of the domain object.
  • They often signal that something is about to happen that can't logically happen, like a state change that isn't allowed or conceptually possible.
  • Exception messages may contain more information than you'd like to share with the user.
  • Validation errors often require internationalization (i18n).

He explains each option and, where it helps, provides code examples to illustrate. He then moves on to the frontend, talking about changes to the UI when exceptions are thrown and some things on his "wish list" for frontend exception handling.

tagged: exception user messaging handling opinion tutorial

Link: https://matthiasnoback.nl/2018/04/exceptions-and-talking-back-to-the-user/

Stitcher.io Blog:
PHPStorm tips for power users
Mar 28, 2018 @ 14:22:11

PHPStorm users out there might want to check out this list of helpful hints from the Stitcher.io blog covering some "lesser-known-yet-powerful features" of the IDE that could help improve your daily workflow.

Their list includes:

  • binding keys to pane display preferences (ex: floating, windowed, etc)
  • namespace auto-importing
  • "copy path" of the current file
  • defining custom JVM options
  • inspection of why a term/word is syntax highlighted

Each of the items on the list comes with a description of where to make changes and animated GIFs of where to find it in the interface and what it looks like. If you're not a PHPStorm user and want to find out more about this IDE offered by JetBrains, check out this page on their website.

tagged: phpstorm tip user developer list feature ide jetbrains

Link: https://www.stitcher.io/blog/phpstorm-tips-for-power-users

TutsPlus.com:
How to Create a Custom Authentication Guard in Laravel
Nov 10, 2017 @ 17:53:25

In the TutsPlus.com site there's a tutorial posted showing you how to create a custom guard in Laravel by building on top of the current system to integrate it with a MongoDB database.

In this article, we’re going to cover the authentication system in the Laravel framework. The main aim of this article is to create a custom authentication guard by extending the core authentication system.

Laravel provides a very solid authentication system in the core that makes the implementation of basic authentication a breeze. [...] Moreover, the system itself is designed in such a way that you could extend it and plug in your custom authentication adapters as well. That’s what we'll discuss in detail throughout this article.

The article then starts out with a brief description of the two parts of the system: "guards" and "providers". It then provides the list of files that will be involved and where they belong in the overall structure. From there it's on to the configuration changes and code required to make the link to the MongoDB database and the creation of the User model and authentication provider. Next comes the code to create the guard and what's required to tie it all together and make the full system work. The tutorial wraps up with an example of testing this new guard via a simple controller call.

tagged: laravel tutorial guard authentication user framework mongodb

Link: https://code.tutsplus.com/tutorials/how-to-create-a-custom-authentication-guard-in-laravel--cms-29667

Unnikked.ga:
How To Schedule User Generated Cron Jobs In Laravel
Oct 10, 2017 @ 14:55:05

On the Unnikked.ga site there's a tutorial posted by Nicola Malizia showing you how to schedule user-generated cron jobs in Laravel using the built-in job handling functionality.

While developing a personal project I was in the need to let user defines actions that run periodically.

My first thought was to use the Task Scheduling component of Laravel. The solution that I came up with is quite simple, yet effective.

He then walks through the process of setting up a "tasks" table where users can define their jobs and how to pull and execute them as a part of the Kernel.php configuration. He ends the post asking readers if there's another way they might go about this and still allow users to define their own jobs without having to write the code for each type.

tagged: laravel schedule user job tutorial task kernel

Link: https://unnikked.ga/how-to-schedule-user-generated-cron-jobs-in-laravel-8a1e0400bb10

Rob Allen:
Adding a user to your Bluemix space
Aug 25, 2017 @ 15:09:01

Rob Allen continues his series looking at the "serverless PHP" environment that is a part of the IBM Bluemix offering. In his previous post he introduced some of the basic concepts of using the service and helped you create a sample "Hello World" function. In this new tutorial he shows how to update that environment and create a user and allow them access to the PHP functions already created.

I'm at the stage where I need to give another developer access to my IBM Cloud Functions actions. I'm not really an infrastructure person and I found the user management pages on the Bluemix console incomprehensible, so used the command line. This is how I did it so that I don't have to work it all out again.

There's only two steps to the process: adding the user to your organization and adding the user to the space. He goes through both steps, explaining how it works and the command line calls to make it happen. This also provides the added user with access to related resources (like databases).

tagged: bluemix serverless user add commandline tutorial ibm

Link: https://akrabat.com/adding-a-user-to-your-bluemix-space/

Twilio Blog:
Creating a Symfony 3 Project with Basic User Handling
Aug 18, 2017 @ 14:56:26

On the Twilio blog they've posted a new tutorial from author Margaret Staples showing you how to create a Symfony 3 project with user handling along with the Friends of Symfony bundle.

User handling is a fundamental part of a ton of web projects. This post will walk through how to get setup using the Symfony 3 framework and the Friends of Symfony bundle so that your project can allow users to register, login and out, and view and edit their User profile. The steps here will serve as a great starting point for your next web project.

She then walks you through the installation of the Symfony standard edition and how to answer some of the interactive setup questions. Once that's set up she shows how to install the FriendsOfSymfony/FOSUserBundle and what configuration options need to be changed to implement it. She then shows how to update the database schema for the new user handling and how to check to be sure the login, registration and profile pages are working as expected.

tagged: symfony3 project user handling tutorial install configure migrate

Link: https://www.twilio.com/blog/2017/08/up-and-running-with-symfony-3.html


Trending Topics: