2017 © Pedro Peláez
 

library php-result-store

Universal result store

image

kharanenka/php-result-store

Universal result store

  • Thursday, April 5, 2018
  • by Andrey Kharanenka
  • Repository
  • 1 Watchers
  • 1 Stars
  • 1,112 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 8 Versions
  • 27 % Grown

The README.md

Class Result

Universal result store: - status (bool) - data (mixed) - message (string) - code (string), (*1)

Installation

Require this package in your composer.json and update composer., (*2)

"kharanenka/php-result-store": "2.2.*"

Usage

You can use class "Result" in any places your application. Class "Result" is singleton., (*3)

Set result data methods:

  • setData(mixed $obData) - Set result data
  • setTrue(mixed $obData = null) - Set result data with status "true"
  • setFalse(mixed $obData = null) - Set result data with status "false"
  • setMessage(string $sMessage) - Set message string
  • setCode(string $sCode) - Set code value

Get result data method:

  • status() - Get result status flag true/false
  • data() - Get data value (object/array/string)
  • message() - Get message value
  • code() - Get code value
  • get() - Get array result array
  • getJSON() - Get array result array in JSON string
    //Result array
    [
        'status'    => false/true
        'data'      => object
        'message'   => 'Message text',
        'code'      => 1015,
    ]
    //Example 1
    Result::setMessage('Error')->setCode(400)->setFalse();

    ...
    if(!Result::status()) {
        return Result::get();
    }

    //Example 2
    return Result::setTrue($obData)->getJSON();

The Versions

05/04 2018

dev-master

9999999-dev

Universal result store

  Sources   Download

GPL-3.0

The Requires

  • php >=5.5

 

by Avatar Andrey Kharanenka

php store result

05/04 2018

2.1.0

2.1.0.0

Universal result store

  Sources   Download

GPL-3.0

The Requires

  • php >=5.5

 

by Avatar Andrey Kharanenka

php store result

31/05 2017

2.0.0

2.0.0.0

Universal result store

  Sources   Download

GPL-3.0

The Requires

  • php >=5.5

 

by Avatar Andrey Kharanenka

php store result

10/10 2016

dev-dev

dev-dev

Universal result store

  Sources   Download

GPL-3.0

The Requires

  • php >=5.5

 

by Avatar Andrey Kharanenka

php store result

10/10 2016

1.0.4

1.0.4.0

Universal result store

  Sources   Download

GPL-3.0

The Requires

  • php >=5.5

 

by Avatar Andrey Kharanenka

php store result

10/10 2016

1.0.3

1.0.3.0

Universal result store

  Sources   Download

GPL-3.0

The Requires

  • php >=5.5

 

by Avatar Andrey Kharanenka

php store result

27/09 2016

1.0.2

1.0.2.0

Generation universal response

  Sources   Download

GPL-3.0

The Requires

  • php >=5.5

 

by Avatar Andrey Kharanenka

php result

16/09 2016

1.0.0

1.0.0.0

Generation universal response

  Sources   Download

GPL-3.0

The Requires

  • php >=5.5

 

by Avatar Andrey Kharanenka

php result