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
use Zend\Crypt\Password\Apache; | |
$apache = new Apache(); | |
$apache->setFormat('crypt'); | |
printf ("CRYPT output: %s\n", $apache->create('password')); | |
$apache->setFormat('sha1'); | |
printf ("SHA1 output: %s\n", $apache->create('password')); |
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
enrico@enrico-desktop:~/Lavoro/Git/zf2/tests$ phpunit Zend\Mvc | |
PHPUnit 3.7.13 by Sebastian Bergmann. | |
Cannot open file "ZendMvc.php". | |
enrico@enrico-desktop:~/Lavoro/Git/zf2/tests$ phpunit ZendTest/Mvc | |
PHPUNIT: 3.7.13 | |
PHPUnit 3.7.13 by Sebastian Bergmann. | |
Configuration read from /home/enrico/Lavoro/Git/zf2/tests/phpunit.xml.dist |
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
$ ./composer.phar install | |
Loading composer repositories with package information | |
Installing dependencies | |
- Installing zendframework/zend-version (2.1.1) | |
Loading from cache | |
- Installing zendframework/zendframework (2.1.1) | |
Loading from cache | |
zendframework/zendframework suggests installing doctrine/common (Doctrine\Common >=2.1 for annotation features) |
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
/** | |
* Generate random bytes using OpenSSL or Mcrypt and mt_rand() as fallback | |
* | |
* @param integer $length | |
* @param bool $strong true if you need a strong random generator (cryptography) | |
* @return string | |
* @throws Exception\RuntimeException | |
*/ | |
public static function getBytes($length, $strong = false) | |
{ |
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
// rename the Zend\Stdlib\ArrayObject in Zend\Stdlib\ArrayObjectPHPFuture | |
// and copy he Zend\Stdlib\compatibility\ArrayObject in Zend\Stdlib\ArrayObjectPHPLegacy | |
if (version_compare(PHP_VERSION, '5.3.4', 'lt') { | |
class_alias('Zend\Stdlib\ArrayObjectPHPLegacy', 'ArrayObject'); | |
} else { | |
class_alias('Zend\Stdlib\ArrayObjectPHPFuture', 'ArrayObject'); | |
} | |
$test = new ArrayObject(); |
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 | |
$database = ''; | |
$hostname = ''; | |
$port = ''; | |
$user = ''; | |
$password = ''; | |
return array( | |
'db' => array( |
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 | |
$database = ''; | |
$user = ''; | |
$password = ''; | |
$hostname = ''; | |
$port = 446; | |
$conn_string = "DRIVER={IBM DB2 ODBC DRIVER};DATABASE=$database;". | |
"HOSTNAME=$hostname;PORT=$port;PROTOCOL=TCPIP;UID=$user;PWD=$password;"; |
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
/GET /user | |
OK Response (200): | |
{ | |
"user" : { | |
"name" : "Foo", | |
"email" : "foo@bar.com" | |
} | |
} |
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
RPC: GET /getalbum | |
Request | |
{ "id" : 1 } | |
OK Response (200): | |
{ | |
"id" : 1, | |
"artist" : { | |
"name" : "Metallica", | |
"history" : "Simply the best heavy metal band ever!", | |
"genre" : "Heavy metal, Hard rock, Speed metal, Thrash metal" |
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
CREATE TABLE post ( | |
id int(11) NOT NULL auto_increment, | |
title varchar(100) NOT NULL, | |
content TEXT NOT NULL, | |
user_id int(11), | |
category_id int(11), | |
publish_date DATETIME, | |
PRIMARY KEY (id) | |
); |