Skip to content

Instantly share code, notes, and snippets.

Avatar

Andreas Frömer icanhazstring

View GitHub Profile
@icanhazstring
icanhazstring / test.php
Created Mar 10, 2016
AOP Method Depedency Binding
View test.php
/**
* @dependency($awesomeService => \Common\Service\AwesomeService)
* @dependency($megaService => \Common\Service\MegaService)
*/
public function getFubar($id, $dependecies)
{
$awesomeService = $dependencies->awesomeService;
$megaService = $dependencies->megaService;
$awesomeService->getData($id);
@icanhazstring
icanhazstring / Vagrantfile
Created Sep 6, 2017
Simple Vagrantconfig PHP7.1 + composer
View Vagrantfile
Vagrant.configure("2") do |config|
config.vm.box = "puphpet/ubuntu1604-x64"
config.vm.provision "shell", inline: <<-SHELL
add-apt-repository ppa:ondrej/php
apt-get update
apt-get install -y php7.1 php7.1-xml php7.1-mbstring php7.1-zip php7.1-curl php7.1-xdebug composer
# Switch to /vagrant and install packages
cd /vagrant && composer install
@icanhazstring
icanhazstring / composer-windows-vagrant.bat
Last active Jan 24, 2019
IntelliJ/PHPStorm composer remote execution using Vagrant
View composer-windows-vagrant.bat
:: Prerequisties
:: - Git for Windows
:: - Vagrant
"C:\Program Files\Git\bin\sh.exe" -c "vagrant ssh -c 'cd /vagrant && composer %*'"
:: Setting up composer in IDE
:: Settings > Languages & Frameworks > PHP > Composer
:: Insert /path/to/your/composer.bat
@icanhazstring
icanhazstring / delete-merged-branches.sh
Last active Mar 19, 2019
Git delete multiple remote merged branches
View delete-merged-branches.sh
# git branch -r --merged master
## List all remote merged branches (master)
# awk -Forigin/ '/\/PVKZU-/ {print $2}'
## remove origin/ prefix
# tr '\n' ' '
## Replace new line with space (to get one single argument)
# xargs -rt git push origin --delete
@icanhazstring
icanhazstring / .travis.yml
Created Feb 14, 2019
Enable Travis PHP Build on Windows
View .travis.yml
# default os is linux
matrix:
include:
- language: php
php: 7.2
before_script:
- composer install
after_script:
- sh .travis.coverage.sh
View how-to-archive-only-composer-dev-dependencies.md

How to archive only composer require-dev with all their dependencies

To optimize our CI builds we wanted to split our production dependencies from out dev dependencies. So that we would aquire two seperate archives which could be deployed seperatley.

For production we would only deploy production.tar.gz for testing we would deploy require.tar.gz and require-dev.tar.gz.

Unfortunately composer only comes with the composer install/update -no-dev that would ignore installation of dev dependencies.

Currently we are running two composer install while moving the vendor/ into vendor_prod/ and so forth using rsync to find the differenc between prod and dev installation and creating the proper tar balls. Sadly this creates a huge IO load.

View gist:71d974a58d2f35e8abc8
## install
yum install zeromq-devel
## install zmq.so
cd ~
git clone git://github.com/mkoppanen/php-zmq.git
cd php-zmq
phpize && ./configure
make && make install