PHP code example of hammerstone / sidecar
1. Go to this page and download the library: Download hammerstone/sidecar 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/ */
hammerstone / sidecar example snippets
namespace App\Sidecar;
use Hammerstone\Sidecar\LambdaFunction;
class OgImage extends LambdaFunction
{
public function handler()
{
// Define your handler function.
return 'lambda/image.handler';
}
public function package()
{
// All files and folders needed for the function.
return [
'lambda',
];
}
}
Route::get('/ogimage', function () {
return OgImage::execute([
'text' => 'PHP to JS and Back Again!'
]);
});
php artisan sidecar:deploy --activate