Skip to content

Instantly share code, notes, and snippets.

View alphaolomi's full-sized avatar
🎯
Focusing

Alpha alphaolomi

🎯
Focusing
View GitHub Profile
@alphaolomi
alphaolomi / composer.json
Created May 28, 2022 01:57
Composer.json minimal stub
{
"name": "name/example",
"description": "demo",
"type": "project",
"license": "MIT",
"authors": [
{
"name": "Your Name",
"email": "youremial@gmail.com"
}
@alphaolomi
alphaolomi / remove_laravel_comments.php
Created June 16, 2022 22:41 — forked from jakebathman/remove_laravel_comments.php
Remove comments from fresh Laravel files
<?php
/*
|--------------------------------------------------------------------------
| Remove Laravel Comments
|--------------------------------------------------------------------------
|
| Just made a new Laravel project, but don't want all those big
| comment blocks? Put this in the root of your project and run
| "php remove_laravel_comments.php"
|
@alphaolomi
alphaolomi / guide.md
Created June 25, 2022 18:08
OPINIONATED DEFINITION OF QUALITY

OPINIONATED DEFINITION OF QUALITY for PHP packages

Based on thephpleague Definition

  1. Use a vendor namespace (Alphao in my case) for PSR-4 autoloading. Place code in a src folder.

  2. Adhere to PSR-2 as the coding style guide.

@alphaolomi
alphaolomi / check_extensions.php
Created July 1, 2022 19:41
Check all required PHP extension for Laravel
<?php
// OpenSSL PHP Extension
// PDO PHP Extension
// Mbstring PHP Extension
// Tokenizer PHP Extension
// XML PHP Extension
// SQLite PHP Extension (for SQLite3 support)
$extensionsList = [

Here's the base sanitizer:

<?php

namespace FooProject\Internal\Sanitizers;

abstract class BaseSanitizer
{
    /**

Github Labels Guide

1 Guide Assumptions

This guide is created to make work with labels on Github more constructive and understandable both to development and management parts of the team.

@alphaolomi
alphaolomi / pest_make_tests.php
Created November 3, 2022 21:36
Make PestPHP Tests for all files in src/
<?php
//
// Generate tests according to files in src/
// usefull on writin tests for packages
//
// Author: Alpha Olomi
// Date: 4 Nov 2022
//
@alphaolomi
alphaolomi / pint.json
Created January 17, 2023 13:46 — forked from JustSteveKing/pint.json
Laravel Pint configuration
{
"preset": "psr12",
"rules": {
"align_multiline_comment": true,
"array_indentation": true,
"array_syntax": true,
"blank_line_after_namespace": true,
"blank_line_after_opening_tag": true,
"combine_consecutive_issets": true,
"combine_consecutive_unsets": true,
@alphaolomi
alphaolomi / Pdf.php
Created January 18, 2023 12:59
Extending spatie/pdf-to-text Pdf Class
<?php
namespace App\Services;
class Pdf extends \Spatie\PdfToText\Pdf
{
public function __construct(?string $binPath = '/usr/bin/pdftotext')
{
if (!file_exists($binPath)) {
$binPath = '/usr/local/bin/pdftotext';
@alphaolomi
alphaolomi / bad_oop.php
Created January 19, 2023 08:27
Don't Try this
<?php
// https://twitter.com/timacdonald87/status/1615918480976662529/photo/1
class Foo
{
static function bar()
{
return Bar::class;
}
}