Skip to content

Instantly share code, notes, and snippets.

Avatar
👑
Test all the thing

Michiel Gerritsen michielgerritsen

👑
Test all the thing
View GitHub Profile
@michielgerritsen
michielgerritsen / deploy.php
Created Jan 27, 2020
Restart php-fpm on Laravel Forge using Deployer
View deploy.php
<?php
desc('Restart php-fpm');
task('php-fpm:restart', function () {
run('sudo service php7.3-fpm reload');
});
after('deploy:symlink', 'php-fpm:restart');
@michielgerritsen
michielgerritsen / ComposerWordPressValetDriver.php
Last active Jul 7, 2019
A Laravel Valet driver for WordPress installations in the ./wordpress/ folder. Save in ~/.valet/Drivers/ComposerWordPressValetDriver.php
View ComposerWordPressValetDriver.php
<?php
class ComposerWordPressValetDriver extends BasicValetDriver
{
/**
* Determine if the driver serves the request.
*
* @param string $sitePath
* @param string $siteName
* @param string $uri
View MagentoServiceProvider.php
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class MagentoServiceProvider extends ServiceProvider
{
/**
* Bootstrap services.
*
@michielgerritsen
michielgerritsen / disable-modules.sh
Last active Oct 30, 2017
Disable all non Magento modules in Magento 2
View disable-modules.sh
php bin/magento module:disable $(php bin/magento module:status |grep -vE 'Magento|List|None|^$')
View readme.md
  1. Go to Deployment Hooks -> Clone new release -> After this action -> Add Hook and add this line:
ln -s {{project}}/storage/wp-config.php {{release}}/wp-config.php
  1. Add this configuration under Linked Folders:
wp-content/uploads -> storage/wp-content/uploads	
@michielgerritsen
michielgerritsen / README.md
Created Jun 16, 2017
Enable Xdebug on OSX for CLI scripts
View README.md

This is tested with MAMP PRO, but should work with other installs types of PHP. Add this to your ~/.bashrc file. When you have an CLI script you would like to debug with Xdebug, simply call enablexdebug from your terminal, and enable Xdebug within PhpStorm.

View update-single-package.sh
composer update vendor/packagename
@michielgerritsen
michielgerritsen / gittag.php
Last active Apr 11, 2017
Retrieve the latest tag, based on the sorted version - https://packagist.org/packages/controlaltdelete/git-version
View gittag.php
/**
* Retrieve the git version number so we can show it.
*/
$files = [];
$dir = dirname(dirname(dirname(__FILE__))) . '/.git/refs/tags';
if(file_exists($dir)) {
foreach (new DirectoryIterator($dir) as $file) {
if ($file->isDot()) {
continue;
}
@michielgerritsen
michielgerritsen / bitbucket-pipelines.yml
Created Mar 18, 2017
Testing Laravel on Bitbucket Pipelines.
View bitbucket-pipelines.yml
image: phpunit/phpunit:5.0.3
pipelines:
default:
- step:
script:
- composer install
- cp .env.example .env
- php artisan key:generate
- chmod 777 storage bootstrap/cache -Rv
@michielgerritsen
michielgerritsen / SecureWww.php
Created Feb 12, 2017
Middleware for Laravel to check if SSL is enabled and the domain is on www and redirects if necessary. If the domain starts with dev it continues.
View SecureWww.php
<?php
namespace App\Http\Middleware;
use Closure;
class SecureWww
{
/**
* Handle an incoming request.