View gist:11373254
This file contains 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 | |
include '/path/to/vendor/autoload.php'; | |
use ZendOAuth\Token\Access as AccessToken; | |
use Zend\Http\Request; | |
use Zend\Http\Response; | |
$config = array( | |
'callbackUrl' => 'http://example.com/callback.php', | |
'siteUrl' => 'http://twitter.com/oauth', |
View gist:e2b528ba160197d0c773
This file contains 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 | |
{ |
View gist:eff5072ef7ccd0298a6b
This file contains 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' | |
)); |
View gist:92d9f6b8ed62f9fd71c7
This file contains 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', |
View gist:0769f99e45a04e124cf0
This file contains 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); |
View CatalogEntity.php
This file contains 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; |
View test.php
This file contains 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' ]; | |
} |
View gist:2050095
This file contains 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 Zend\Log; | |
use Zend\Log\Logger; | |
interface LoggerAware | |
{ | |
public function setLogger(Logger $logger); | |
public function getLogger(); | |
} |
View gist:2051907
This file contains 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
protected function prepareInsert($adapter, $table, array $fields) | |
{ | |
$sql = 'INSERT INTO ' . $adapter->platform->quoteIdentifier($table) . ' (' . | |
implode(",",array_map(array($adapter->platform, 'quoteIdentifier'), $fields)) . ') VALUES (' . | |
implode(",",array_map(array($adapter->driver, 'formatParameterName'), $fields)) . ')'; | |
return $sql; | |
} |
View gist:2577720
This file contains 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
// The table queue is empty, I got this Fatal error: Uncaught exception 'Zend\Db\Adapter\Exception\InvalidQueryException' with message 'No database selected' in /.../library/Zend/Db/Adapter/Driver/Pdo/Statement.php on line 219 | |
use Zend\Db\TableGateway\TableGateway, | |
Zend\Db\Adapter\Adapter as DbAdapter; | |
$options = array( | |
'driver' => 'pdo_mysql', | |
'username' => 'queue', | |
'password' => 'xxx', | |
'dbname' => 'queue', |
OlderNewer