Skip to content

Instantly share code, notes, and snippets.

View lloricode's full-sized avatar
🔍
Learning something

Lloric Mayuga Garcia lloricode

🔍
Learning something
View GitHub Profile
@DaveLiddament
DaveLiddament / PHP generics notation for static analysis.md
Created October 30, 2022 14:13
PHP generics notation for static analysis

Notation for generics to PHP: #<>

Disclaimer: I assume someone has already suggested this and there are good reasons it hasn't happened!

Inspired by a conversation with @pronskiy after my talk "PHP Generics Today (Almost)" at IPC Munich

Examples:

class Queue #
<div class="tailwind" x-data="{ age: 0, name: '', coppa: false }">
<div class="border rounded-lg my-12 max-w-md">
<div class="p-6">
<h1
class="mt-0"
x-show="$wizard.current().title !== ''"
x-text="$wizard.current().title"
></h1>
<?php
namespace Tests;
use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\ValidationException;
use Illuminate\Validation\Validator;
use Symfony\Component\HttpFoundation\ParameterBag;
use function PHPUnit\Framework\assertFalse;
@themsaid
themsaid / AppServiceProvider.php
Created January 26, 2020 16:24
Re-encryption after APP_KEY rotation
<?php
namespace App\Providers;
use App\Encrypter;
use Illuminate\Support\Str;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
@poing
poing / laravel_facades.md
Last active March 25, 2024 21:37
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.

@LegitDongo
LegitDongo / sqlsrv-php.sh
Last active January 26, 2023 16:57
SQLSRV PHP Drivers that work for Laravel Homestead
# Best if added to `after.sh` so that this gets run every time the box is provisioned
# Adjust versions as needed; most of this script is forcing php7.2
# 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
@bironeaj
bironeaj / recipe.sh
Last active April 13, 2024 03:26
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
@davidpiesse
davidpiesse / Schedulable.php
Last active September 7, 2023 15:22
Laravel Custom Class/Model Scheduling
<?php
//Don't forget to change the namespace!
namespace App\Traits;
use Cron\CronExpression;
use Illuminate\Support\Carbon;
use Illuminate\Console\Scheduling\ManagesFrequencies;
trait Schedulable{
#!/bin/sh
# If you would like to do some extra provisioning you may
# add any commands you wish to this file and they will
# be run after the Homestead machine is provisioned.
wget https://xdebug.org/files/xdebug-2.5.5.tgz
tar xvzf xdebug-2.5.5.tgz
cd xdebug-2.5.5
phpize
@iEdzar
iEdzar / MY_Controller.php
Last active April 21, 2017 17:08
https://github.com/lloricode/ci-capstone/tree/a35913562223d00239215bf9b06d473dc1e118db header scrollable conflicts before this commit in dynamic table bootstap: $this->table_bootstrap for ci_capstone
<?php
class CI_Capstone_Controller extends MY_Controller
{
/**
*
* @param array $header header
* @param array $table_data_rows rows
* @param string $table_config table bootstrap
* @param string $caption_lang caption