PHP code example of michaeljennings / broker

1. Go to this page and download the library: Download michaeljennings/broker library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

michaeljennings / broker example snippets


broker()->put($user, 'navigation', $navigationItems, 60);

'providers' => [
  ...
  'Michaeljennings\Broker\BrokerServiceProvider'
  ...
];

'aliases' => [
  ...
  'Broker' => 'Michaeljennings\Broker\Facades\Broker',
  ...
];

class Dummy implements \Michaeljennings\Broker\Contracts\Cacheable
{
	public function getCacheKey()
	{
		return get_class($this);
	}
}

use Illuminate\Database\Eloquent\Model;

class Dummy extends Model implements \Michaeljennings\Broker\Contracts\Cacheable
{
	use \Michaeljennings\Broker\Traits\Cacheable;
}

// Facade
Michaeljennings\Broker\Facades\Broker::get($cachable, 'key');
// Helper
broker()->get($cachable, 'key');
// IOC Binding
app(Michaeljennings\Broker\Contracts\Broker)->get($cachable, 'key');

broker()->get($cacheable, 'key');

broker()->has($cacheable, 'key');

broker()->remember($cacheable, 'key', function() {
  return DB::table('users')->get();
});

broker()->put($cacheable, 'key', 'value');
broker()->put($cacheable, 'key', 'value', $minutes);

broker()->forever($cacheable, 'key');

broker()->forget($cacheable, 'key');

broker()->flush($cacheable);

broker()->flushAll(App\User::class);