2017 © Pedro Peláez
 

library support

Prologue Support is an extension for Illuminate Support

image

prologue/support

Prologue Support is an extension for Illuminate Support

  • Thursday, February 9, 2017
  • by tabacitu
  • Repository
  • 2 Watchers
  • 16 Stars
  • 15,415 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 5 Versions
  • 1 % Grown

The README.md

Prologue Support

Latest Stable Version Total Downloads Build Status, (*1)

This package is now abandoned. No further development or bug fixes will happen., (*2)

Prologue Support is an extension for Illuminate Support. It provides you with extra helper functionality for your application., (*3)

Maintained by Cristian Tabacitu, (*4)

Table of Contents

Installation

You can install Prologue Support for your project through Composer., (*5)

Require the package in your composer.json., (*6)

"prologue/support": "dev-master"

Run composer to install or update the package., (*7)

$ composer update

Usage

Collection

The Collection.php class in Prologue Support comes with some additional functions., (*8)

filterBy($key, $value)

Used to filter for records which have a specific value set for a given key., (*9)

$data = array(
    array('name' => 'foo', 'age' => 21),
    array('name' => 'bar', 'age' => 20),
    array('name' => 'baz', 'age' => 9),
);

$collection = new Prologue\Support\Collection($data);

// Will return only records with an age of 20.
$items = $collection->filterBy('age', 20)->all();

orderBy($key, $direction)

Used to order records by a given key., (*10)

$data = array(
    array('name' => 'foo', 'age' => 21),
    array('name' => 'bar', 'age' => 20),
    array('name' => 'baz', 'age' => 9),
);

$collection = new Prologue\Support\Collection($data);

// Will order the records by its age in ascending order.
$items = $collection->orderBy('age')->all();

You can also order in a descending way., (*11)

$items = $collection->orderBy('age', 'desc')->all();

MessageBag

The MessageBag class in Prologue Support offers the ability to add arrays or other MessageBags as messages., (*12)

$bag = new Prologue\Support\MessageBag;
$bag->add('error', array(
    'email' => 'Incorrect email address',
    'url'   => 'Incorrect url',
));
$messages = $bag->get('error'); 

Now $messages equals to:, (*13)

array(
    array(
        'email' => 'Incorrect email address',
        'url'   => 'Incorrect url',
    )
);

You see? One of the messages is the array we added., (*14)

The same goes for instances of Illuminate\Support\MessageBag., (*15)

$bag->add('error', new Illuminate\Support\MessageBag);

Helper Functions

is_true($value)

Determine if a value is true., (*16)

$result = is_true(true) // true
$result = is_true(null) // false

is_false($value)

Determine if a value is false., (*17)

$result = is_false(false) // true
$result = is_false(null) // false

last_key(array $value)

Get the last key from an array., (*18)

$data = array('foo' => 'bar', 'baz' => 'foz');
$result = last_key($data); // 'baz'

Changelog

You view the changelog for this package here., (*19)

License

Prologue Support is licensed under the MIT License., (*20)

The Versions

09/02 2017

dev-master

9999999-dev https://github.com/Prologue/Support

Prologue Support is an extension for Illuminate Support

  Sources   Download

MIT

The Requires

 

laravel helpers collection support

07/02 2015

v1.1.1

1.1.1.0 https://github.com/Prologue/Support

Prologue Support is an extension for Illuminate Support

  Sources   Download

MIT

The Requires

 

laravel helpers collection support

07/02 2015

v1.1.0

1.1.0.0 https://github.com/Prologue/Support

Prologue Support is an extension for Illuminate Support

  Sources   Download

MIT

The Requires

 

laravel helpers collection support

08/10 2013

v1.0.1

1.0.1.0 https://github.com/Prologue/Support

Prologue Support is an extension for Illuminate Support

  Sources   Download

MIT

The Requires

 

laravel helpers support

04/08 2013

v1.0.0

1.0.0.0 https://github.com/Prologue/Support

Prologue Support is an extension for Illuminate Support

  Sources   Download

MIT

The Requires

 

laravel helpers support