Skip to content

Instantly share code, notes, and snippets.

@neoacevedo
neoacevedo / get_commit.php
Created January 13, 2018 00:20
Devuelve el commit actual desde 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 November 24, 2017 03:35
Run composer from Web Browser
<?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 November 8, 2017 03:25
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"
<?php
namespace johnitvn\rbacplus\models;
use Yii;
use yii\base\Model;
use yii\rbac\Item;
/**
* @author John Martin <john.itvn@gmail.com>