Skip to content

Instantly share code, notes, and snippets.

Avatar
🤩
My Github sponsor page is alive 🎉 https://github.com/sponsors/samsonasik/

Abdul Malik Ikhsan samsonasik

🤩
My Github sponsor page is alive 🎉 https://github.com/sponsors/samsonasik/
View GitHub Profile
@samsonasik
samsonasik / barcode.php
Last active Aug 11, 2022
barcode save download
View barcode.php
<?php
// ...
public function barcodeAction()
{
$barcodeOptions = array('text' => 'ZEND-FRAMEWORK');
$barcode = \Zend\Barcode\Barcode::factory('code39', 'Image', $barcodeOptions);
//temporary save file into data folder
imagegif($barcode->draw(), './data/barcode.gif');
@samsonasik
samsonasik / cara-penggunaan-codeigniter-coding-standard.md
Created Aug 30, 2021
cara penggunan codeigniter coding standard
View cara-penggunaan-codeigniter-coding-standard.md
@samsonasik
samsonasik / symfony-tips1-prod-dev.md
Last active Apr 5, 2021
symfony tips 1 - switch dev - prod or prod - dev again
View symfony-tips1-prod-dev.md
@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)
{
@samsonasik
samsonasik / gist:3988701
Created Oct 31, 2012
Send HTML Mail Using ZF2
View gist:3988701
use Zend\Mail\Message;
use Zend\Mail\Transport\Smtp as SmtpTransport;
use Zend\Mime\Message as MimeMessage;
use Zend\Mime\Part as MimePart;
use Zend\Mail\Transport\SmtpOptions;
//////////
$message = new Message();
View DsnReader.php
<?php
class DsnReader
{
private $dsn;
public function __construct($dsn)
{
$this->dsn = $dsn;
}
@samsonasik
samsonasik / gist:4171219
Created Nov 29, 2012
set #zf2 in shared hosting ( .htaccess )
View gist:4171219
RewriteCond %{HTTP_HOST} ^yourdomain.com$ [NC,OR]
RewriteCond %{REQUEST_URI} !yourapp/public
RewriteRule (.*) /yourapp/public/$1 [L]
place it at your public_html (shared hosting 'root' directory ).
if you call http://yourdomain.com so you will point out to public_html/yourapp/public/index.php
View table-prefix-in-columns-zend-db.md

Assumption:

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

include 'vendor/autoload.php';
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
{