1. Go to this page and download the library: Download thejawker/chainable 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/ */
thejawker / chainable example snippets
$someClass = new SomeClass();
$someClass->someMethod();
$someClass->someOtherMethod();
// Now you can just write it like this.
new Chain(SomeClass::class)
->someMethod()
->someOtherMethod();
// Or even easier
ch(SomeClass::class)
->someMethod()
->someOtherMethod();
// Through passing the Class's classname.
$someClass = new Chain(SomeClass::class);
// Or through passing the actual instance
$someClass = new Chain(new SomeClass($withParams))
$property = new Chain(SomeClass::class)->property;
$someClass = new Chain(SomeClass::class)->someMethod()
$property = $someClass->escape()->getValue() // will return the original value
$someClass = new Chain(SomeClass::class)->someMethod();
$sameInstance = $someClass->escape();
$sameInstance->unescape()->otherMethod();
public function calculate()
{
return new Chain(new LegacyClass)
->someMethod()
->setSome('stuff')
->maybeMore()
->instance();
}