Skip to content

Instantly share code, notes, and snippets.

@BinaryKitten
BinaryKitten / composer.json
Created June 27, 2025 08:58
Snippet for composer to only update dev dependencies
"update-dev": [
"composer show --name-only --direct > all-deps",
"composer show --name-only --direct --no-dev > no-dev-deps",
"grep -v -f no-dev-deps all-deps > dev-deps",
"composer update -W $(< dev-deps)",
"composer bump --dev-only",
"rm all-deps no-dev-deps dev-deps"
],
@BinaryKitten
BinaryKitten / AppServiceProvider.php
Last active June 8, 2024 08:33
streamedPsrResponse Macro
<?php
declare(strict_types=1);
namespace App\Providers;
use Illuminate\Http\Client\Response as HttpClientResponse;
use Illuminate\Support\ServiceProvider;
use Symfony\Bridge\PsrHttpMessage\Factory\HttpFoundationFactory;
use Symfony\Component\HttpFoundation\StreamedResponse;
<?php
declare(strict_types=1);
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use App\Pseudo\Filters\FilterInterface;
use App\Pseudo\Filters\FilterClassOne;
use App\Pseudo\Filters\FilterClassTwo;
<?php
declare(strict_types=1);
namespace Tests;
use App\SomeClass;
use App\AnotherClass;
use PHPUnit\Framework\TestCase;
use Tests\Traits\TestsObjects;
@BinaryKitten
BinaryKitten / phpunit.bat
Created September 3, 2021 17:25 — forked from jrfnl/phpunit.bat
PHPUnit PHP/PHPUnit switching script example
@echo off
::
:: PHP ??? have Xdebug + Blackfire.
:: PHP 7.4.14 has Xdebug with coverage
:: PHP 7.4.15 has Xdebug with develop + trace
::
:set PHPBIN=C:\wamp\bin\phpcli_x86\php5.2.17\php.exe
:set PHPBIN=C:\wamp\bin\phpcli_x86\php5.3.29\php.exe
:set PHPBIN=C:\wamp\bin\phpcli_x86\php5.4.45\php.exe
:set PHPBIN=C:\wamp\bin\php\php5.5.38\php.exe
<?php
declare(strict_types=1);
namespace App\Plans;
use \Exception;
class InvalidPlanClassException extends Exception
{
<?php
declare(strict_types=1);
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class DbMacrosProvider extends ServiceProvider
{
@BinaryKitten
BinaryKitten / toRawSql.php
Last active January 22, 2023 21:52
toRawSql.php
<?php
declare(strict_types=1);
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
use Illuminate\Database\Query\Builder as QueryBuilder;
QueryBuilder::macro(
'toRawSql',
function () {
<?php
// this is routes/web.php
Route::twillioWebhook('/blah', Controller::class);
<?php
declare(strict_types=1);
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class RemovePercentageCommissionFeesFromAuctionListings extends Migration
{