Skip to content

Instantly share code, notes, and snippets.

@jeffhappens
jeffhappens / add_possessive
Last active January 13, 2022 03:44
Laravel Helper function that converts a string to a possessive
<?php
// Add this function to app/helpers.php
if ( ! function_exists('str_possessive')) {
/**
* Make a string possessive.
* @param string $string
* @return string
*/
function str_possessive($string) {
return $string.'\''.($string[strlen($string) - 1] != 's' ? 's' : '');
@paulredmond
paulredmond / ValidateMailgunWebhook.php
Created April 24, 2017 21:55
Laravel Middleware to Validate a signed Mailgun webhook
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Response;
/**
* Validate Mailgun Webhooks
* @see https://documentation.mailgun.com/user_manual.html#securing-webhooks
@calebporzio
calebporzio / composer_versions_cheatsheet.md
Last active September 30, 2024 08:58
Composer version symbol cheatsheet
...
"require": {
    "vendor/package": "1.3.2", // exactly 1.3.2 (exact)

    // >, <, >=, <= | specify upper / lower bounds
    "vendor/package": ">=1.3.2", // anything above or equal to 1.3.2
    "vendor/package": "<1.3.2", // anything below 1.3.2

 // * | wildcard
@fideloper
fideloper / stream_file.php
Last active November 8, 2024 09:51
Stream file from S3 to browser, assume Laravel Filesystem usage
<?php
/*************************************************************************
* Get File Information
*/
// Assuming these come from some data source in your app
$s3FileKey = 's3/key/path/to/file.ext';
$fileName = 'file.ext';