Skip to content

Instantly share code, notes, and snippets.

$ php -v
PHP 5.5.14-2+deb.sury.org~precise+1 (cli) (built: Jul 2 2014 12:07:02)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies
with Xdebug v2.2.5, Copyright (c) 2002-2014, by Derick Rethans
{
"require": {
"guzzlehttp/guzzle": "4.1.*@dev",
"guzzlehttp/streams": "dev-master"
}
}
<?php
use Zend\Db\Adapter\Adapter;
use Zend\Db\Sql\Sql;
use Zend\Db\Sql\Where;
use Zend\Db\Adapter\Profiler\Profiler;
use Zend\Db\Adapter\StatementContainer;
/**
* @see http://blog.kazuhooku.com/2014/07/the-json-sql-injection-vulnerability.html
@sasezaki
sasezaki / sample.php
Last active August 29, 2015 14:03
frolic with zf-fr Hydrator
<?php
use Hydrator\ObjectPropertyHydrator;
use Hydrator\Strategy\DateStrategy;
use Hydrator\Strategy\StrategyInterface;
use Hydrator\Context\ExtractionContext;
use Hydrator\Context\HydrationContext;
use Zend\Uri\UriInterface;
use Zend\Uri\UriFactory;
<?php
// I'm not fun to see your handling data masturbation.
// (I'm not intend DDD, too)
// Don't annoy me with such article. http://www.1x1.jp/blog/2014/06/how-to-scan-array-in-php.html
use Zend\Stdlib\Hydrator;
require_once 'vendor/autoload.php';
$usersData = [
<?php
use Symfony\Component\DomCrawler\Crawler;
require 'vendor/autoload.php';
$html = mb_convert_encoding('<html><head><meta charset="Shift_JIS"></head><body>日本語①②③</body></html>', 'SJIS-win', 'UTF-8');
$crawler = new Crawler;
$crawler->addContent($html);
var_dump($crawler->filterXPath('//body')->text()); // string(9) "日本語"
@sasezaki
sasezaki / Module.php
Created February 17, 2014 15:44
Trap Reserved Username For ZfcUser module
<?php
namespace TrapReservedUsernameForZfcUser;
use Zend\Mvc\MvcEvent;
use Zend\Validator\ValidatorChain;
use Zend\Validator\Callback;
use ZfcUser\Validator\NoRecordExists;
class Module
@sasezaki
sasezaki / paralle_request.php
Created February 12, 2014 15:54
Sample - multi request and output to file with Artax
<?php
use Artax\Request;
$reactor = (new Alert\ReactorFactory)->select();
$client = new Artax\AsyncClient($reactor);
class OutputFileSpecifiedRequest extends Request
{
private $filename;
<?php
class TestClass
{
private $internalScalar;
public function __construct($arg)
{
$this->internalScalar = $arg;
}
@sasezaki
sasezaki / phpdbg.md
Last active July 30, 2023 13:51
phpdbg - 新しいオールドスクールデバッガ

phpdbg - 新しいオールドスクールデバッガ

phpdbgcom.png

PHPのコア周辺での活動が顕著な krakjoe -Joe Watkins氏に より新しいプロジェクトが発足した。PHP用デバッガ phpdbg だ。ここ数日karkjoe・felipensp両氏により活発に開発が行われている。

これは、C言語開発者にはお馴染みのGDBに似たデバッグ環境をPHP向けに提供する。