This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Sign a file with a private key using OpenSSL | |
# Encode the signature in Base64 format | |
# | |
# Usage: sign <file> <private_key> | |
# | |
# NOTE: to generate a public/private key use the following commands: | |
# | |
# openssl genrsa -aes128 -passout pass:<passphrase> -out private.pem 2048 | |
# openssl rsa -in private.pem -passin pass:<passphrase> -pubout -out public.pem |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Experimantal plugin manager complaint with ContainerInterface with options support | |
* using the optional Interface rule of PHP | |
*/ | |
use Interop\Container\ContainerInterface; | |
class PluginManager implements ContainerInterface | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Get the router adapters installed | |
*/ | |
public function getRouterAdapters() | |
{ | |
$adapters = []; | |
if (class_exists('Aura\Router\Router')) { | |
$adapters[] = [ 'Zend\Expressive\Router\Aura' ]; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Zend\Stratigility\MiddlewarePipe; | |
use Zend\Diactoros\Server; | |
require 'vendor/autoload.php'; | |
$app = new MiddlewarePipe(); | |
$server = Server::createServer($app, $_SERVER, $_GET, $_POST, $_COOKIE, $_FILES); | |
// Injected for all the URL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Ecommerce\V1\Rest\Catalog; | |
class CatalogEntity | |
{ | |
public $id; | |
public $name; | |
public $description; | |
public $picture; | |
public $price; | |
public $quantity; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// config/autoload/global.php | |
// ... | |
'router' => array( | |
'routes' => array( | |
'oauth' => array( | |
'options' => array( | |
'route' => '/oauth', | |
), | |
), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Benchmark the Pbkdf2 iteration (10'000 = 50 ms, using an Intel i5 CPU at 2) | |
use Zend\Crypt\Key\Derivation\Pbkdf2; | |
use Zend\Math\Rand; | |
$salt = Rand::getBytes(32); | |
$pass = 'this is the password of the user'; | |
$start = microtime(true); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// route configuration, for instance in a module.config.php | |
// ... | |
'home' => array( | |
'type' => 'segment', | |
'options' => array( | |
'route' => '/[:lang/]', | |
'defaults' => array( | |
'__NAMESPACE__' => 'Application\Controller', | |
'controller' => 'Index', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
set_include_path('path/to/zf1/library'); | |
require_once 'Zend/Db.php'; | |
$db = Zend_Db::factory('Pdo_Mysql', array( | |
'host' => '127.0.0.1', | |
'username' => '', | |
'password' => '', | |
'dbname' => 'test' | |
)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Test\V1\Rpc\Test; | |
use Zend\Mvc\Controller\AbstractActionController; | |
use ZF\ContentNegotiation\ViewModel; | |
use ZF\Hal\Entity; | |
use ZF\Hal\Link\Link; | |
class TestController extends AbstractActionController | |
{ |