sukohi/memento

A PHP package mainly developed for Laravel to check result using boolean value.

2.0.2 2015-08-05 17:54 UTC

This package is not auto-updated.

Last update: 2024-04-27 14:38:43 UTC


README

A PHP package mainly developed for Laravel to check result using boolean value.
(This is for Laravel 5+. For Laravel 4.2)

Installation

Add this package name in composer.json

"require": {
  "sukohi/memento": "2.*"
}

Execute composer command.

composer update

Register the service provider in app.php

'providers' => array(  
    ...Others...,  
    Sukohi\Memento\MementoServiceProvider::class,
)

Also alias

'aliases' => array(  
    ...Others...,  
    'Memento'   => Sukohi\Memento\Facades\Memento::class
)

Usage

$boolean = true;
$memento = \Memento::set($boolean)
            ->set(function(){

                return \Item::where('id', 1)->exists();

            });

if($memento->allTrue()) {

    echo 'All True';

}

if($memento->allFalse()) {

    echo 'All False';

}

if($memento->hasTrue()) {

    echo 'Has True';

}

if($memento->hasFalse()) {

    echo 'Has False';

}

License

This package is licensed under the MIT License.

Copyright 2015 Sukohi Kuhoh