Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.
/ utils Public archive

Paquete de uso personal con cosas que uso día a día...

License

Notifications You must be signed in to change notification settings

abr4xas/utils

Repository files navigation

Utils

Latest Version on Packagist GitHub Tests Action Status Total Downloads GitHub forks GitHub license

Un simple paquete de php que puede servir de utilidad a cualquiera con muchas herramientas que facilitan el desarrollo de proyectos mucho más rápido.


how to install

composer require abr4xas/utils

Then:

$ composer update
$ composer dumpautoload -o // optional

how to use

<?php

require 'vendor/autoload.php';

use Abr4xas\Utils\SeoUrl;
use Abr4xas\Utils\Gravatar;
use Abr4xas\Utils\TimeFormat;
use Abr4xas\Utils\SuggestKeyword;
use Abr4xas\Utils\PrettyPrintArray;

$slug = SeoUrl::generateSlug('this is an awesome string');
// this-is-an-awesome-string

$gravatar = Gravatar::getAvatarUrl('[email protected]', ['s' => 80, 'd' => 'mm', 'secure' => true]);
// https://secure.gravatar.com/avatar/0b84841f9b6236d312515dc83046078c?s=80&d=mm&r=g

$timeAgo = TimeFormat::timeAgo('2020-08-25');
// 21 hours ago

PrettyPrintArray::prettyPrintArray($var);

$keywords = SuggestKeyword::SuggestKeyword('php');

PrettyPrintArray::prettyPrintArray($keywords);

// Output:

// Array
// (
//     [0] => php
//     [1] => phpmyadmin
//     [2] => php date
//     [3] => phpstorm
//     [4] => php online
//     [5] => php array length
//     [6] => php foreach
//     [7] => phpunit
//     [8] => php array
//     [9] => php try catch
// )

random string generator usage

<?php

use Abr4xas\Utils\RandomStringGenerator;

$token = (new RandomStringGenerator)->generate();

custom alphabet

<?php

$customAlphabet = '0123456789ABCDEF';

// you can set the custom alphabet from the constructor
$token = (new RandomStringGenerator($customAlphabet))->generate();

// or you can set a new alphabet whenever needed like this:

$token = (new RandomStringGenerator)->setAlphabet($customAlphabet)->generate();

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.