Skip to content

Instantly share code, notes, and snippets.

View lloricode's full-sized avatar
💻

Lloric Mayuga Garcia lloricode

💻
View GitHub Profile
@lloricode
lloricode / recipe.sh
Created September 19, 2018 23:46 — forked from bironeaj/recipe.sh
Ubuntu IBM DB2 ODBC + CLI + PHP PDO Installation Instructions/Script - Tailored for Laravel Forge
# Install Dev Package
sudo apt install php7.2-dev
# CD Home
cd ~
# Get CLI
wget -q -O CLI.tar.gz https://iwm.dhe.ibm.com/sdfdl/v2/regs2/smkane/IDSOC/Xa.2/Xb.bL-snMrfTDtX6PgwwuXqAdeiFX6UY09DUuicweVTRlk/Xc.ibm_data_server_driver_for_odbc_cli_linuxx64_v11.1.tar.gz/Xd./Xf.LPr.D1vk/Xg.9810279/Xi.swg-idsoc97/XY.regsrvs/XZ.42v0ODLDocGa6RjgsAKBjJobG6U/ibm_data_server_driver_for_odbc_cli_linuxx64_v11.1.tar.gz
# Get PDO
wget -q -O PDO.tar.gz https://pecl.php.net/get/PDO_IBM-1.3.5.tgz
# Unpack Files & Cleanup
tar -zxf CLI.tar.gz
@lloricode
lloricode / php7-fpm_xdebug_nginx.md
Created October 28, 2018 07:32 — forked from rahilwazir/php7-fpm_xdebug_nginx.md
Quick guide to setup Nginx with PHP7-FPM and XDebug

PHP7

  • Ubuntu 16.04+
$ sudo add-apt-repository ppa:ondrej/php
$ sudo apt update
$ sudo apt install nginx php7.1-fpm php7.1-cli php7.1-common php7.1-json php7.1-opcache php7.1-mysql php7.1-phpdbg php7.1-mbstring php7.1-gd php7.1-imap php7.1-ldap php7.1-pgsql php7.1-pspell php7.1-recode php7.1-soap php7.1-tidy php7.1-dev php7.1-intl php7.1-curl php7.1-zip php7.1-xml php-xdebug
@lloricode
lloricode / CatchAllOptionsRequestsProvider.php
Created December 25, 2018 04:49 — forked from danharper/CatchAllOptionsRequestsProvider.php
Lumen with CORS and OPTIONS requests
<?php namespace App\Providers;
use Illuminate\Support\ServiceProvider;
/**
* If the incoming request is an OPTIONS request
* we will register a handler for the requested route
*/
class CatchAllOptionsRequestsProvider extends ServiceProvider {
@lloricode
lloricode / Laravel-Container.md
Created February 5, 2019 23:27
Laravel's Dependency Injection Container in Depth

Laravel's Dependency Injection Container in Depth

Translations: Korean (by Yongwoo Lee)

Laravel has a powerful Inversion of Control (IoC) / Dependency Injection (DI) Container. Unfortunately the official documentation doesn't cover all of the available functionality, so I decided to experiment with it and document it for myself. The following is based on Laravel 5.4.26 - other versions may vary.

Introduction to Dependency Injection

I won't attempt to explain the principles behind DI / IoC here - if you're not familiar with them you might want to read What is Dependency Injection? by Fabien Potencier (creator of the Symfony framework).

@lloricode
lloricode / laravel_facades.md
Created February 6, 2019 09:36 — forked from poing/laravel_facades.md
Laravel Facades

Understanding Facades in Laravel

What's a Facade?

The Laravel explination, shown below is confusing.

Facades provide a "static" interface to classes that are available in the application's service container. Laravel ships with many facades which provide access to almost all of Laravel's features. Laravel facades serve as "static proxies" to underlying classes in the service container, providing the benefit of a terse, expressive syntax while maintaining more testability and flexibility than traditional static methods.

Many examples use Cache::get('key') to demonstrate how a Facade works. Comparing the following code to the utility that a Facade provides.

Bringing machine 'homestead' up with 'virtualbox' provider...
==> homestead: Importing base box 'laravel/homestead'...
==> homestead: Matching MAC address for NAT networking...
==> homestead: Checking if box 'laravel/homestead' version '8.0.0' is up to date...
==> homestead: Setting the name of the VM: homestead
==> homestead: Clearing any previously set network interfaces...
==> homestead: Preparing network interfaces based on configuration...
homestead: Adapter 1: nat
homestead: Adapter 2: hostonly
==> homestead: Forwarding ports...
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'php-imagick' instead of 'php7.2-imagick'
The following additional packages will be installed:
fonts-droid-fallback fonts-noto-mono ghostscript gsfonts imagemagick-6-common libcupsfilters1 libcupsimage2 libfftw3-double3 libgs9 libgs9-common libijs-0.35 libjbig2dec0
liblqr-1-0 libmagickcore-6.q16-3 libmagickwand-6.q16-3 libpaper-utils libpaper1 poppler-data ttf-dejavu-core
Suggested packages:
fonts-noto ghostscript-x libfftw3-bin libfftw3-dev libmagickcore-6.q16-3-extra poppler-utils fonts-japanese-mincho | fonts-ipafont-mincho fonts-japanese-gothic
| fonts-ipafont-gothic fonts-arphic-ukai fonts-arphic-uming fonts-nanum
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
1/131: https://codeload.github.com/doctrine/instantiator/legacy.zip/a2c590166b2133a4633738648b6b064edae0814a
2/131: https://codeload.github.com/sebastianbergmann/code-unit-reverse-lookup/legacy.zip/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18
3/131: https://codeload.github.com/sebastianbergmann/php-file-iterator/legacy.zip/050bedf145a257b1ff02746c31894800e5122946
4/131: https://codeload.github.com/phar-io/version/legacy.zip/45a2ec53a73c70ce41d55cedef9063630abaf1b6
5/131: https://codeload.github.com/theseer/tokenizer/legacy.zip/11336f6f84e16a720dae9d8e6ed5019efa85a0f9
6/131: https://codeload.github.com/phar-io/manifest/legacy.zip/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4
7/131: https://codeload.github.com/phpspec/prophecy/legacy.zip/1927e75f4ed19131ec9bcc3b002e07fb1173ee76
8/131: https://codeload.github.com/sebastianbergmann/php
@lloricode
lloricode / sqlsrv-php7.2.sh
Created July 29, 2019 02:09 — forked from LegitDongo/sqlsrv-php.sh
SQLSRV PHP 7.2 Drivers that work for Laravel Homestead
# Best if added to `after.sh` so that this gets run every time the box is provisioned
# composer won't be able to download updates with an active proxy, and will hang trying to get the newest file
# You may want to comment this out based on your network configuration
sudo bash -c 'echo "export NO_PROXY=*" >> ~/.profile'
sudo add-apt-repository ppa:ondrej/php -y
sudo apt-get update
sudo apt-get install php7.2-dev php7.2-xml mcrypt php-pear php-mbstring unixodbc unixodbc-dev -y --allow-unauthenticated
@lloricode
lloricode / homestead_sqlsrv_driver_installer.sh
Created July 29, 2019 02:28 — forked from jeremykenedy/homestead_sqlsrv_driver_installer.sh
SQL Server Driver Installer for Laravel Homestead
#!/bin/bash
# SQL Server Driver Installer for Laravel Homestead
#
# This script downloads, compiles, and installs the PHP 7 extension
# files for both the native sqlsrv and the PDO pdo_sqlsrv drivers.
# Get the Microsoft Driver Source Code from Github
cd ~
git clone https://github.com/Microsoft/msphpsql.git
cd msphpsql