Lazy Loading - allejo/PhpPulse GitHub Wiki
In order to keep this library as lightweight and efficient as possible, it will make only the necessary API calls as they're needed. Starting with version 0.3.0 of the library, all objects' constructors available in this library take a second parameter, which when set to true, will lazily load the object. Meaning, it won't make an API call until you request some information.
Note: Starting with version 0.4.0, all objects will be lazy loaded by default.
// No API call made, yet
$board = new PulseBoard(1234, true);
$board->getName(); // an API call is finally made
Why does it matter?
This library is designed to depend heavily on itself to make things easier for whoever is using it. Here's an example of why lazy loading is beneficial.
Without Lazy Loading
Let's say in one of your functions, you are only creating a pulse and you don't need any of the board information. Without lazy loading, you'll be making one API call too many.
// API call made to get all of the information for the board
$board = new PulseBoard(1234, false);
// Second API call made to create a pulse in this board
$board->createPulse('My Pulse Title', 1);
With Lazy Loading
In this example, you just need the board object to create a pulse so you can lazy load the board so no extra API calls are made.
// No API call made
$board = new PulseBoard(1234, true);
// Second API call made to create a pulse in this board
$board->createPulse('My Pulse Title', 1);