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

ThisData Blog:
Subscribing to Symfony's Security Events
Nov 01, 2016 @ 17:27:22

In this recent post to the ThisData blog Nick Malcolm shows you a method for subscribing to the events that the Symfony framework throws during the course of its execution with simple listeners.

Symfony is a popular web framework for PHP apps, and comes with a powerful event notification system which fires events when almost anything happens inside the system. Hooking in to these events can add advanced functionality to your app.

The most common way to listen to an event is to register either an event "listener", or an event "subscriber". We're going to use Subscribers. In this post we'll create a Subscriber which listens for successful and unsuccessful Log In events, and responds by sending information to ThisData.

He starts with a Symfony demo application and show the creation of a basic subscriber to specifically listen to the security events. In this case they're only looking for authentication failures and interactive logins. He walks through what the subscriber code is doing step-by-step and includes the registration of the subscriber. This includes an update to send the event results over to the ThisData service for easier ingestion and reporting. This final step isn't a requirement to get the subscriber working, it's just an optional step they've provided as one method to handle the eventing output.

tagged: security events thisdata symfony subscriber tutorial

Link: https://thisdata.com/blog/subscribing-to-symfonys-security-events/

Jonathan Wage's Blog:
Blending the Doctrine ORM and MongoDB ODM
Aug 26, 2010 @ 18:34:40

On his blog today Jonathan Wage has posted a tip on getting MongoDB connections and queries to work through the Doctrine ORM layer:

Since the start of the Doctrine MongoDB Object Document Mapper project people have asked how it can be integrated with the ORM. This blog post demonstrates how you can integrate the two transparently, maintaining a clean domain model. This example will have a Product that is stored in MongoDB and the Order stored in a MySQL database.

His code shows how to define the document and entity for the connection (a Product and Order) and creating an event subscriber to lazy load the product. He creates a sample Product and an Order for it and save them to the database. He also includes code to pull an order back out by its ID number and get an Order object back out (with Product data inside).

tagged: doctrine orm mongodb document entity subscriber event tutorial

Link:

Keith Casey's Blog:
Event Driven Programming
May 27, 2010 @ 16:05:15

In a new post to his blog today Keith Casey talks about something that might be a bit foreign to some PHP developers out there event driven programming. He relate it to the Flex world where it's more commonly used.

When you initially dive into the world of Flex development, most PHP'ers will quickly notice something weird. We're out of the world of Request/Response that we know and understand and into an odd world of Events, Listeners, and Publishers/Subscribers where things just don't play well together.

He talks about the Observer design pattern and how it works to provide an interface to other objects who are listening in and waiting for events to happen (he uses an airline analogy). He also gives a more concrete illustration - uploading a file - and how the events would be used to handle each part of the process.

tagged: event driven programming flex observer publisher subscriber

Link:

Vidyut Luther's Blog:
Adding Subscribers to Campaign Monitor Lists using PHP5 and SOAP
Dec 15, 2008 @ 15:33:07

If you're a Campaign Monitor user (an email marketing tool targeted at designers) and have wanted to dynamically add people to your lists, Vidyut Luther has a solution for you:

This is a quick how to, for people interested in adding subscribers to their Campaign Monitor lists. What you'll need: PHP 5 with SOAP built in, a Valid Campaign Monitor Account, a Campaign Monitor list.

His simple script (about 10 lines with comments removed) makes a call to the service's API and passes in your key, a list and client ID and a call to the AddSubscriber method to push the new contact into the list.

tagged: campaignmonitor mailing list add subscriber tutorial php5 soap

Link:


Trending Topics: