PHP code example of prologue / support

1. Go to this page and download the library: Download prologue/support 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/ */

    

prologue / support example snippets


$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();

$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();

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

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

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

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

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

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

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