Skip to content

Instantly share code, notes, and snippets.

@sasezaki
sasezaki / hydrator_desirializer.php
Last active June 21, 2016 11:28
tasting implementation hydrator, serializer
<?php
declare(strict_types=1);
namespace ClassHydrator {
interface ClassHydrationInterface
{
public function hydrate(array $data, string $className);
}
@sasezaki
sasezaki / zend-mvc-mini.php
Created June 19, 2016 03:03
example , run zend-mvc minimal for debug
<?php
// INSTALL: $composer require zendframework/zend-mvc:^3
// USAGE: $php -d allow_url_include=1 zend-mvc-mini.php
namespace Application {
use Zend\Router\Http\Literal;
use Zend\Router\Http\Segment;
use Zend\Mvc\Controller\AbstractActionController;
use Zend\ServiceManager\Factory\InvokableFactory;
@sasezaki
sasezaki / yapcasia-8oji-2016mid-timetable_propose.md
Last active August 17, 2016 09:52
『Zend Framework その11年』という題で考えたけれども

表記するお名前、SNSアカウント

sasezaki http://twitter.com/sasezaki

概要

Zend Framework というプロダクト・コンセプトが世にでてから11年が経過しようしています。この発表では、私がZend Frameworkを中心に PHPのOSSに関する各種トピックについて感じたことを振り返って見たいと思います。

  • 導入
  • Zend Framework 登場前
@sasezaki
sasezaki / zundoko.php
Created April 4, 2016 14:19
ズンドコキヨシ・コーディングに対する感想
<?php
/**
* ズンドコキヨシ・コーディングに対する感想
*
* 設問から派生したところを考えた場合、
* ズンドコキヨシ問題をPHPとFSMで解く http://developer.cybozu.co.jp/akky/2016/03/zundoko-kiyoshi-in-php-and-fsm/
* などは導入したほうが分かりやすくなる例としてなるほどなとは思ったり、
* 短くするコードゴルフ始めてたりしてフーン(読みにくっ)と思ったり
*
@sasezaki
sasezaki / CacheAdapter.php
Created January 25, 2016 15:54
zend paginator cache renew
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
namespace Zend\Paginator\Adapter;
@sasezaki
sasezaki / 23658.diff
Last active January 25, 2016 14:49
zf1 paginator diffs
Index: Adapter/DbSelect.php
===================================================================
--- Adapter/DbSelect.php (revision 23657)
+++ Adapter/DbSelect.php (revision 23658)
@@ -100,7 +100,9 @@
if ($rowCount instanceof Zend_Db_Select) {
$columns = $rowCount->getPart(Zend_Db_Select::COLUMNS);
- $countColumnPart = $columns[0][1];
+ $countColumnPart = empty($columns[0][2])
<?php
use Zend\Paginator\Paginator;
use Zend\Db\Adapter\Adapter;
use Zend\Cache\StorageFactory;
use Zend\Db\TableGateway\TableGateway;
require_once 'vendor/autoload.php';
$adapter = new Zend\Db\Adapter\Adapter(array(
'driver' => 'Pdo_Sqlite',
@sasezaki
sasezaki / middleware.php
Created January 13, 2016 15:57
An Middleware Builder in a tweet
<?php
// Minified
// class B{function __construct($m){$this->m = $m;} function __invoke($req,$res) {if($this->m)return array_shift($this->m)($req,$res,$this);}}
class B{
function __construct($m)
{
$this->m = $m;
}
@sasezaki
sasezaki / convert.php
Created November 17, 2015 16:50
PHP-Backporter snippet
<?php
// git clone https://github.com/nikic/PHP-Backporter.git
// git submodule init
// git submodule update
// in PHPBackporter_Converter_Namespace, should change like below.
// $functionDataParser->parse(file_get_contents(dirname(__FILE__).'/../../../function.data')),
$file = $argv[1];
<?php
use Zend\Diactoros\Response;
require_once __DIR__.'/vendor/autoload.php';
$res = new Response();
$res->getBody()->write('hello');
$contents = $res->getBody()->getContents();
var_dump($contents); // ""