2017 © Pedro Peláez
 

library test

An example component, which has a few methods for testing/example purposes.

image

plinker/test

An example component, which has a few methods for testing/example purposes.

  • Monday, May 14, 2018
  • by lcherone
  • Repository
  • 1 Watchers
  • 1 Stars
  • 273 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 23 Versions
  • 0 % Grown

The README.md

PlinkerRPC - Test/Demo

A test/demo component which has a few basic methods which demostrate how easy it is to define a class to interface to, a range of data types can be sent back from strings, arrays, objects, closures or even self/this for testing/example purposes., (*1)

Make sure you check out the components code, there is no complicated voodoo going on, its just a simple PHP class., (*2)

Install

Require this package with composer using the following command:, (*3)

``` bash $ composer require plinker/test, (*4)


## Client Creating a client instance is done as follows: <?php require 'vendor/autoload.php'; /** * Initialize plinker client. * * @param string $server - URL to server listener. * @param string $config - server secret, and/or a additional component data */ $client = new \Plinker\Core\Client( 'http://example.com/server.php', [ 'secret' => 'a secret password', 'array' => [ 'key' => 'value' ] ] ); // or using global function $client = plinker_client('http://example.com/server.php', 'a secret password', [ 'array' => [ 'key' => 'value' ] ]); ## Methods Once setup, you call the class though its namespace to its method. ### This By calling this you can return the entire class to call locally. **Call** ``` php $client->test->this();

Response ``` text Plinker\Test\Test Object ( [config] => Array ( [array] => Array ( [key] => value ), (*5)

    )

), (*6)


If your wondering where the `config` array is coming from.. its passed in the connection, see above client section. ### Config This shows a "getter" for the class which returns the config. **Call** ``` php $client->test->config();

Response ``` text Array ( [array] => Array ( [key] => value ), (*7)

), (*8)


### An Array This shows returning a basic array. :/ **Call** ``` php $client->test->an_array();

Response ``` text Array ( [0] => Hello World ), (*9)


### A Closure This shows returning a closure (anonymous function) which was serialised with [(opis/closure) SerializableClosure](https://github.com/opis/closure). **Call** ``` php $client->test->closure()('foo');

Response ``` text foo, (*10)


### Run Closure This shows running a closure (anonymous function) on the server from the client which was serialised with [(opis/closure) SerializableClosure](https://github.com/opis/closure). This allows you to neatly mutate any data before its returned back from the server. **Call** ``` php $client->test->run_closure(function ($value = []) { return implode(' ', $value); })

Response ``` text Hello World, (*11)


### An Object This shows returning an object, in this example a DateTime object. **Call** ``` php $client->test->date();

Response ``` text DateTime Object ( [date] => 2018-05-11 15:53:34.655980 [timezone_type] => 3 [timezone] => UTC ), (*12)


### A String This shows returning an string, in this example it returns the IP address of the server. **Call** ``` php $client->test->my_ip(); $client->test->your_ip();

Response ``` text 10.158.250.158, (*13)

10.158.250.1 ```, (*14)

Testing

There are no tests setup for this component., (*15)

Contributing

Please see CONTRIBUTING for details., (*16)

Security

If you discover any security related issues, please contact me via https://cherone.co.uk instead of using the issue tracker., (*17)

Credits

Development Encouragement

If you use this project and make money from it or want to show your appreciation, please feel free to make a donation https://www.paypal.me/lcherone, thanks., (*18)

Sponsors

Get your company or name listed throughout the documentation and on each github repository, contact me at https://cherone.co.uk for further details., (*19)

License

The MIT License (MIT). Please see License File for more information., (*20)

See the organisations page for additional components., (*21)

The Versions

14/05 2018

dev-master

9999999-dev https://github.com/plinker-rpc/test

An example component, which has a few methods for testing/example purposes.

  Sources   Download

MIT

The Requires

 

test rpc example plinker

14/05 2018

v1.3.8

1.3.8.0 https://github.com/plinker-rpc/test

An example component, which has a few methods for testing/example purposes.

  Sources   Download

MIT

The Requires

 

test rpc example plinker

14/05 2018

v1.3.7

1.3.7.0 https://github.com/plinker-rpc/test

An example component, which has a few methods for testing/example purposes.

  Sources   Download

MIT

The Requires

 

test rpc example plinker

11/05 2018

v1.3.6

1.3.6.0 https://github.com/plinker-rpc/test

An example component, which has a few methods for testing/example purposes.

  Sources   Download

MIT

The Requires

 

test rpc example plinker

10/05 2018

v1.3.5

1.3.5.0 https://github.com/plinker-rpc/test

An example component, which has a few methods for testing/example purposes.

  Sources   Download

MIT

The Requires

 

test rpc example plinker

08/05 2018

v1.3.4

1.3.4.0 https://github.com/plinker-rpc/test

An example component, which has a few methods for testing/example purposes.

  Sources   Download

MIT

The Requires

 

test rpc example plinker

05/05 2018

v1.3.3

1.3.3.0 https://github.com/plinker-rpc/test

An example component, which has a few methods for testing/example purposes.

  Sources   Download

MIT

The Requires

 

test rpc example plinker

03/05 2018

v1.3.2

1.3.2.0 https://github.com/plinker-rpc/test

An example component, which has a few methods for testing/example purposes.

  Sources   Download

MIT

The Requires

 

rpc plinker

03/05 2018

v1.3.1

1.3.1.0 https://github.com/plinker-rpc/test

An example component, which has a few methods for testing/example purposes.

  Sources   Download

MIT

The Requires

 

rpc plinker

23/01 2018

v1.3.0

1.3.0.0 https://github.com/plinker-rpc/test

An example component, which has a few methods for testing/example purposes.

  Sources   Download

MIT

The Requires

 

rpc plinker

30/09 2017

v1.2.0

1.2.0.0 https://github.com/plinker-rpc/test

An example component, which has a few methods for testing/example purposes.

  Sources   Download

MIT

The Requires

 

rpc plinker

21/09 2017

v1.1.4

1.1.4.0 https://github.com/plinker-rpc/test

An example component, which has a few methods for testing/example purposes.

  Sources   Download

MIT

The Requires

 

rpc plinker

06/09 2015

v0.1

0.1.0.0

  Sources   Download

MIT