Skip to content

Instantly share code, notes, and snippets.

Avatar
😎
You can support my Open Source work: https://samsonasik.wordpress.com/donate/

Abdul Malik Ikhsan samsonasik

😎
You can support my Open Source work: https://samsonasik.wordpress.com/donate/
View GitHub Profile
@samsonasik
samsonasik / CreateDb.php
Last active Mar 12, 2020
create db command with ci 4
View CreateDb.php
<?php namespace App\Commands;
use CodeIgniter\CLI\BaseCommand;
use CodeIgniter\CLI\CLI;
class CreateDb extends BaseCommand
{
protected $group = 'app';
protected $name = 'app:createdb';
protected $description = 'Create database';
View multiple closure in routes in ci4 for filter except
$routes->group('user', [
'filter' => 'permission:manage-user',
'namespace' => 'agungsugiarto\boilerplate\Controllers\Users',
],
function($routes)
{
$routes->get('show', 'UserController::show', ['as' => 'user-show']);
},
function ($routes)
{
View table-prefix-in-columns-zend-db.md

Assumption:

  • table: album
  • columns: id, data
<?php

include 'vendor/autoload.php';
View DsnReader.php
<?php
class DsnReader
{
private $dsn;
public function __construct($dsn)
{
$this->dsn = $dsn;
}
View fdjfaslfjaslfa.md
namespace Foo\Middleware;

use Interop\Http\ServerMiddleware\DelegateInterface;
use Interop\Http\ServerMiddleware\MiddlewareInterface;
use Psr\Http\Message\ServerRequestInterface;
use Zend\Diactoros\Response\JsonResponse;

class JsonWrappingMiddleware implements MiddlewareInterface
{
View gist:1fdb69ee5fa3504d0fcad0f077adaf1d

install zf3 skeleton

composer create-project -sdev zendframework/skeleton-application zf3

install zendframework/zend-mvc-i18n

composer require zendframework/zend-mvc-i18n
@samsonasik
samsonasik / I18nDelegatorFactory.php
Last active Sep 14, 2016
setup i18n in expressive
View I18nDelegatorFactory.php
<?php
// src/App/Helper/I18nDelegatorFactory.php
namespace App\Helper;
use Zend\I18n\View\HelperConfig;
use Zend\ServiceManager\Factory\DelegatorFactoryInterface;
use Interop\Container\ContainerInterface;
class I18nDelegatorFactory implements DelegatorFactoryInterface
{
@samsonasik
samsonasik / download-file-in-expressive.php
Created Sep 9, 2016 — forked from settermjd/download-file-in-expressive.php
Quick example of how to download/stream a file using Zend Expressive.
View download-file-in-expressive.php
<?php
/**
* This is a quick example of how to stream a file to a client, likely a browser,
* using Zend Expressive. There are a lot of factors which it doesn't take in to
* account. But for the purposes of a quick intro, this should suffice.
*/
class ViewDocumentPageAction
{
protected function downloadFile()
{
@samsonasik
samsonasik / config
Created Sep 8, 2016 — forked from donnfelker/config
Watch or Unwatch a file in git
View config
# Goes in your .git/config file
[alias]
# Temporarily stop tracking a file in git.
# usage: git unwatch path/to/file
unwatch = update-index --assume-unchanged
# Resume tracking a file in git.
# usage: git watch path/to/file
watch = update-index --no-assume-unchanged
View doctrine-migration-handle.md
namespace Application\Migration;

use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

/**
 * Auto-generated Migration: Please modify to your needs!
 */
class Version20160704163301 extends AbstractMigration
You can’t perform that action at this time.