PHP code example of elefant / app-wires

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

    

elefant / app-wires example snippets




// Initialize and inject the controller
Wires::init ($this);

// Set your default values here
$defaults = [
	'fname' => 'First',
	'lname' => 'Last'
];

// Handle the request, providing an API callback handler
echo Wires::handle ($defaults, function ($response) {
	// Process API requests here
});

echo Wires::handle ($defaults, function ($response) {
	$response['fname'] = 'Jane';
	$response['lname'] = 'Doe';
	return $response;
});

echo Wires::handle ($defaults, function ($response) {
	return Wires::error (500, 'Nope');
});

$default = [
	'list' => ['One', 'Two', 'Three']
];