How to create an Active Record style PHP SDK Part 8

Last week we looked at setting up the foundation of being able to query the CapsuleCRM API. First we separated the querying functionality into it’s own directory and split each querying action into it’s own trait. Next we created the convention of inferring the API endpoint, but also allowing local configuration to override this convention […]

Continue reading...

Implementing The Specification Pattern

Last week we looked at encapsulating business logic within Value Objects. By using the characteristics of Object Orientated Programming we can maintain the integrity of our business rules within the harmony of using plain old PHP objects. One of the rules that we needed to implement last week was the uniqueness of a user’s username […]

Continue reading...

How to create an Active Record style PHP SDK Part 7

One of the most important aspects of creating an API SDK is the ability to effectively query the underlying API in order to allow the developer to retrieve resources. So far in this series we’ve looked at setting up the HTTP Client using Guzzle and then creating the abstract model that will form the foundation […]

Continue reading...

Encapsulating your application’s business rules

Over the last couple of week’s we’ve looked quite extensively into integrating Doctrine 2 into a Laravel project as well as the unique characteristics and functionality Doctrine 2 offers us as the ORM layer to our applications. Doctrine 2 is an implementation of The Data Mapper pattern. The Data Mapper pattern promotes the separation of […]

Continue reading...

How to create an Active Record style PHP SDK Part 6

Over the last couple of weeks we’ve looked at setting up the foundation of creating an Active Record style PHP SDK. One of the beautiful things about the Active Record pattern is the very intuitive and easy to use interface that is presented to the developer. The Active Record pattern presents entities and their storage […]

Continue reading...

Working with Doctrine 2 Filters

A common requirement you will hear from a business owner or a client is the ability to “filter” results in some sort of way. For example, you probably never want to show spam comments on blogs posts, or you might want to mark certain users as “deleted” without actually having to delete them from the […]

Continue reading...

How to create an Active Record style PHP SDK Part 5

I think it goes without saying that validation is an extremely important aspect of writing high quality applications. Validation enables us to protect the sanity of the data that is allowed across the boundary from the user to the application. Whilst we can all agree that validation is important, where it actually happens is still […]

Continue reading...

Understanding Doctrine 2 Lifecycle Events

A common requirement when building applications is the notion that something must be triggered as a consequence of something else happening within the system. This could be as simply as keeping an updated_at field up-to-date whenever a record in the database is changed, or perhaps sending an email whenever a new user registers for your […]

Continue reading...

How to create an Active Record style PHP SDK Part 4

Last week we started looking at building out the abstract model that will form the foundation of this Active Record style PHP SDK. The models are one of the most important components of the Active Record pattern due to the fact that they hold so much responsibility of the entity you are working with, as […]

Continue reading...

Using Doctrine Query Language

Over the last couple of weeks we’ve looked at Doctrine 2 and how to use it in your PHP projects. Doctrine 2 is an implementation of the Data Mapper pattern and so it allows you to make a clean separation of your application’s business rules from the persistence layer of the database. In this week’s […]

Continue reading...

Supported by