Skip to content

Instantly share code, notes, and snippets.



  • Liftkeeper
  • Budapest, Hungary
View GitHub Profile
agarzon /
Last active Feb 10, 2021
Install globally popular PHP dev tools like composer, phpunit, phpcs, phpmd, phpcpd, deployer, robo, codeception, etc.
#To execute it directly: sudo bash <(curl -s
sudo curl -LsS -o ${BIN_PATH}composer
sudo chmod a+x ${BIN_PATH}composer
m4munib / php_command_pattern.php
Created May 29, 2016
Abstract Class - PHP Command
View php_command_pattern.php
interface InterfaceCommand {
function execute();
abstract class AbstractCommand implements InterfaceCommand {
ozanhazer /
Last active Jun 16, 2019
A very basic PHPUnit runner and watcher for TDD
#!/usr/bin/env bash
# Author: M.Ozan Hazer
# Expects phpunit to be installed via composer to make sure that the
# right version of phpunit is used
# `w` option is for watching the app and test directories for the
# simplest TDD setup
marcellodesales /
Last active Feb 10, 2021
Create Environment Variables in EC2 Hosts from EC2 Host Tags, just like Beanstalk or Heroku does!
# Author: Marcello de Sales (
# Description: Create Create Environment Variables in EC2 Hosts from EC2 Host Tags
### Requirements:
# * Install jq library (sudo apt-get install -y jq)
# * Install the EC2 Instance Metadata Query Tool (
### Installation:
# * Add the Policy EC2:DescribeTags to a User
popravich / PostgreSQL_index_naming.rst
Last active Feb 21, 2021
PostgreSQL index naming convention to remember
View PostgreSQL_index_naming.rst

The standard names for indexes in PostgreSQL are:


where the suffix is one of the following:

  • pkey for a Primary Key constraint;
  • key for a Unique constraint;
  • excl for an Exclusion constraint;
  • idx for any other kind of index;
pastuhov / AcceptanceHelper.php
Last active Feb 16, 2021
codeception page load wait helper
View AcceptanceHelper.php
namespace tests\codeception\common\_support;
use Codeception\Exception\ModuleException;
class AcceptanceHelper extends \Codeception\Module
mindplay-dk /
Last active Jan 9, 2021
Complete overview of the PHP SessionHandler life-cycle

This page provides a full overview of PHP's SessionHandler life-cycle - this was generated by a set of test-scripts, in order to provide an exact overview of when and what you can expect will be called in your custom SessionHandler implementation.

Each example is a separate script being run by a client with cookies enabled.

To the left, you can see the function being called in your script, and to the right, you can see the resulting calls being made to a custom session-handler registed using session_set_save_handler().

ysasaki /
Last active Jan 13, 2021
php-fpm status to AWS CloudWatch
fredbradley /
Last active Nov 4, 2019
Disk Space Checker


This class is quick and simple to install into any PHP application, and is easy to customise to the display you require.

The script finds the amount of total disk space on your system, and then the total free space. We then calculate the used space and give it to you as a percentage.


This class was developed by Fred Bradley -

Setting the path to check

You can choose the path of the disk that you want to check (if you have multiple disks mounted, for example). You can do this by setting the first paramater when calling calling the Class to the directory that you want to check. EG: $disk = new DiskSpaceCheck('/var/www/vhosts/');

nadar / PostMessageToSlackChannel.php
Last active Oct 23, 2020
Post a message to a slack channel with PHP
View PostMessageToSlackChannel.php
* Send a Message to a Slack Channel.
* In order to get the API Token visit:
* The token will look something like this `xoxo-2100000415-0000000000-0000000000-ab1ab1`.
* @param string $message The message to post into a channel.
* @param string $channel The name of the channel prefixed with #, example #foobar