Skip to content

Instantly share code, notes, and snippets.

@neoacevedo
neoacevedo / get_commit.php
Created Jan 13, 2018
Devuelve el commit actual desde PHP
View get_commit.php
<?php
function getVersion() {
// por la tilde invertida se puede ejecutar de manera directa el comando.
if ($commit = sprintf("%s", `git describe --all --long | cut -d "-" -f 3`)) {
return $commit;
} else {
return "No hay commit";
}
}
@neoacevedo
neoacevedo / run_composer.php
Created Nov 24, 2017
Run composer from Web Browser
View run_composer.php
<?php
// $command may have one of the following content:
// $command = ["command" => "install"]; # only for install without anything
// $command = ['command' => 'require', 'packages' => ['maatwebsite/excel:~2.1.0']]; # for install a specific package
// $command = ['command' => 'remove', 'packages' => ['maatwebsite/excel:~2.1.0']]; # for remove a specific package
// define directory for extract
define('EXTRACT_DIRECTORY', "/your/desired/directory");
//Use the Composer classes
use Composer\Console\Application;
@neoacevedo
neoacevedo / AuthItem.php
Created Nov 8, 2017
Updated yii2-rbac-plus AuthItem due for a bug on rule unique validator. I have moved the code inside *unique* method inside a closure method for replacing _unique_ "class validator"
View AuthItem.php
<?php
namespace johnitvn\rbacplus\models;
use Yii;
use yii\base\Model;
use yii\rbac\Item;
/**
* @author John Martin <john.itvn@gmail.com>