Skip to content

Instantly share code, notes, and snippets.

View samsonasik's full-sized avatar
🔥
I am doing very fast fix 🚀, sponsor me 💖 https://github.com/sponsors/samsonasik

Abdul Malik Ikhsan samsonasik

🔥
I am doing very fast fix 🚀, sponsor me 💖 https://github.com/sponsors/samsonasik
View GitHub Profile
@samsonasik
samsonasik / cara-penggunaan-codeigniter-coding-standard.md
Created August 30, 2021 00:55
cara penggunan codeigniter coding standard
@samsonasik
samsonasik / CreateDb.php
Last active March 12, 2020 19:01
create db command with ci 4
<?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';
$routes->group('user', [
'filter' => 'permission:manage-user',
'namespace' => 'agungsugiarto\boilerplate\Controllers\Users',
],
function($routes)
{
$routes->get('show', 'UserController::show', ['as' => 'user-show']);
},
function ($routes)
{

Assumption:

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

include 'vendor/autoload.php';
<?php
class DsnReader
{
private $dsn;
public function __construct($dsn)
{
$this->dsn = $dsn;
}
@samsonasik
samsonasik / fdjfaslfjaslfa.md
Created May 25, 2017 21:31
fjafjalfjaslfjaslfj
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
{

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 September 14, 2016 18:10
setup i18n in expressive
<?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 September 9, 2016 01:30 — forked from settermjd/download-file-in-expressive.php
Quick example of how to download/stream a file using Zend Expressive.
<?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 September 8, 2016 09:01 — forked from donnfelker/config
Watch or Unwatch a file in git
# 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