PHP code example of michaeljennings / utilities

1. Go to this page and download the library: Download michaeljennings/utilities 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 / utilities example snippets


// Item being refined
class ToRefine implements Michaeljennings\Broker\Contracts\Cacheable
{
    /**
     * Get the key to cache the attributes against.
     *
     * @return string
     */
    public function getCacheKey()
    {
        return 'test';
    }

    /**
     * Get the unique key for the cacheable item.
     *
     * @return int|string
     */
    public function getKey()
    {
        return 1;    
    }
}

class Example extends Michaeljennings\Refinery\Refinery
{
    use CachesTemplates;
    
    public function setTemplate($item)
    {
        //
    }
}

'domains' => [
  'app' => 'http://app.example.com',
  'api' => 'http://api.example.com',
]

$url = $domainBuilder->get('app'); // http://app.example.com
$url = $domainBuilder->app(); // http://app.example.com

$url = $domainBuilder->get('app', 'foo/bar'); // http://app.example.com/foo/bar
$url = $domainBuilder->get('app', 'foo', 'bar'); // http://app.example.com/foo/bar
$url = $domainBuilder->app('foo/bar'); // http://app.example.com/foo/bar
$url = $domainBuilder->app('foo', 'bar'); // http://app.example.com/foo/bar

$domainBuilder = new MichaelJennings\Utilities\DomainBuilder(config('utilities.domains'));