Skip to content

Instantly share code, notes, and snippets.

View harikt's full-sized avatar
⛱️
Tanvish Technologies

Hari K T harikt

⛱️
Tanvish Technologies
View GitHub Profile
<?php
namespace Cocoframework\Web_Kernel\Html\Helper;
use Aura\Html\Helper\AbstractHelper;
use Aura\Input\Form;
class InputErrors extends AbstractHelper
{
public function setIntl($intl)
{
<?php
public function modify($di)
{
$signal = $di->get('signal_manager');
$signal->handler('*', 'before_router', function ($obj) {
$cache = dirname(__DIR__) . '/tmp/cache/' . str_replace('/', 'g5', $obj->router->request->url->get(PHP_URL_PATH));
if (is_file($cache) && $obj->router->request->method->isGet()) {
$contents = file_get_contents($cache);
$sender = unserialize($contents);
$sender->__invoke();
@harikt
harikt / questions.md
Last active August 29, 2015 14:04
When and where are you using an event / signal hanlder ?

Are you making use of the event handling system like Symfony event handler, Aura.Signal, Zend event manager or any other in your core framework?

Are you using signal/events before they hit the action class ( controller action ) ?

I have a feeling it will be good to have an event handling system in core of a framework.

The basic idea is to call a signal

  • before a route is checked
  • before dispatching
@harikt
harikt / Author.php
Created August 10, 2014 06:58
Experiments reinventing wheel :)
<?php
class Author
{
private $name;
private $id;
public function __construct(AuthorId $id, $name = '')
{
$this->id = $id;
$this->name = $name;
@harikt
harikt / composer.json
Created September 23, 2014 12:57
Auto resolution of di
{
"require": {
"aura/di":"2.0.*@dev"
}
}
<?php
$max = 100;
for ($current = 1; $current <= $max; $current++) {
$progress = "\r[%-{$max}s](%s/%s)";
echo sprintf($progress, str_repeat("=", $current). '>', $current, $max);
// replace echo with stdio of Aura, so we can make awesome colors also ;)
usleep(6000);
}
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/jrmadsen67/geonames"
}
],
"minimum-stability": "dev",
"require": {
"ipalaus/geonames": "dev-upgrade"
@harikt
harikt / test.php
Last active August 29, 2015 14:08
<?php
class Foo
{
protected $bar;
public function __construct(Bar $bar)
{
$this->bar = $bar;
}
public function someAction()
@harikt
harikt / composer.json
Last active August 29, 2015 14:08
Zend Framework and Session and Remember Me
{
"require": {
"zendframework/zend-session": "~2.3",
"zendframework/zend-eventmanager": "~2.3"
}
}
@harikt
harikt / Common.php
Created October 30, 2014 05:05
Modify the removeScriptPath to make the functionality for /blog and /blog/ to be same url . Remember to make all routes end with / when writing route.
<?php
// In the define method of the project
$di->params['Aura\Web_Kernel\WebKernel']['router'] = $di->lazyNew('Nyams\WebRouter');
// in modify the route tried is
$router->add('blog', '/blog/')
->setValues([
'action' => function () {