Generate Heroku-like random names to use in your php applications.

Overview

HaikunatorPHP

Build Status Latest Version Coverage Status

Generate Heroku-like random names to use in your PHP applications.

Installation

composer require atrox/haikunator

Usage

Haikunator is pretty simple.

use Atrox\Haikunator;

// default usage
Haikunator::haikunate() // => "wispy-dust-1337"

// custom length (default=4)
Haikunator::haikunate(["tokenLength" => 6]) // => "patient-king-887265"

// use hex instead of numbers
Haikunator::haikunate(["tokenHex" => true]) // => "purple-breeze-98e1"

// use custom chars instead of numbers/hex
Haikunator::haikunate(["tokenChars" => "HAIKUNATE"]) // => "summer-atom-IHEA"

// don't include a token
Haikunator::haikunate(["tokenLength" => 0]) // => "cold-wildflower"

// use a different delimiter
Haikunator::haikunate(["delimiter" => "."]) // => "restless.sea.7976"

// no token, space delimiter
Haikunator::haikunate(["tokenLength" => 0, "delimiter" => " "]) // => "delicate haze"

// no token, empty delimiter
Haikunator::haikunate(["tokenLength" => 0, "delimiter" => ""]) // => "billowingleaf"

// custom nouns and/or adjectives
Haikunator::$ADJECTIVES = ["red", "green", "blue"];
Haikunator::$NOUNS = ["reindeer"];
Haikunator::haikunate(); // => "blue-reindeer-4252"

Options

The following options are available:

Haikunator::haikunate([
  "delimiter" => "-",
  "tokenLength" => 4,
  "tokenHex" => false,
  "tokenChars" => "0123456789"
]);

// get/set nouns or adjectives
Haikunator::$ADJECTIVES
Haikunator::$NOUNS

If tokenHex is true, it overrides any tokens specified in tokenChars

Contributing

Everyone is encouraged to help improve this project. Here are a few ways you can help:

Other Languages

Haikunator is also available in other languages. Check them out:

Comments
  • Now a Heroku app

    Now a Heroku app

    opened by stephenhowells 4
  • Eliminate duplicate nouns and add unit tests to check for this issue

    Eliminate duplicate nouns and add unit tests to check for this issue

    I have removed duplicate nouns 'sun' and 'water'. I have also added unit tests to prevent this from happening again. In addition, I have removed the obsolete option 'syntaxCheck' from phpunit.xml.

    On top of that, I have updated the minimum version to the last (only just) supported version, which at this time is 7.2.

    opened by Sandyman 2
  • Removed CLI component, updated docs, tests, removed abandoned dependencies

    Removed CLI component, updated docs, tests, removed abandoned dependencies

    Removed CLI component, updated docs, updated tests, removed abandoned dependencies.

    I also removed the composer.lock, as this is not used for packages but only for implementing projects.

    Fixes #6

    opened by FrontEndCoffee 1
  • Zendframework dependencies are abandoned

    Zendframework dependencies are abandoned

    The dependencies listed below have been abandoned by their maintainers. I would suggest an implementation, with the same specification, only using symfony/console for the command.

    If you want I can draft up a PR with an implementation.

    Another option would be to drop the CLI component all together, which I'd also be happy to make a PR for.

    {
        "zfcampus/zf-console": "^1.2",
        "zendframework/zend-filter": "^2.7",
        "zendframework/zend-validator": "^2.7"
    }
    
    opened by FrontEndCoffee 1
  • Add command line interface application

    Add command line interface application

    This PR adds a small CLI app made with ZF\Console.

    $: ./bin/haikunator help generate
    Haikunator, version dev-master
    
    Usage:
     generate [--token-length=] [--token-chars=] [--token-hex|-x] [--delimiter=] [--nouns=] [--adjectives=]
    
    Arguments:
     --token-length        An integer representing the length of the token; defaults to 4
     --token-chars         The characters to use for the token; defaults to numbers
     --token-hex|-x        Same as --token-chars=0123456789abcdef
     --delimiter           The delimiter for all the part of the result; defaults to '-'
     --nouns|--adjectives  A list of words separated by commas, or a text filename
                           containing words separated by commas, spaces or new lines
    
    Help:
    
    Generate Heroku-like random names
    

    Incidentally, these general changes are also brought:

    • make the main class Haikunator a callable by implementing a non static __invoke() method.
    • add the composer test and composer coverage aliases to execute the respective dev tools.
    • overhaul of the travis setup to use docker containers and other tweaks to speed up the builds
    • bump the minimum PHP version to 5.5, as it was a requirement for the new dependencies, and 5.4 is EOL anyway.
    opened by stefanotorresi 1
Releases(v1.3.0)
Owner
Atrox
(╯°□°)╯︵ xoɹʇɐ
Atrox
A simple Reddit-like forum made where people can talk about anything that has to do with outer space.

SpaceTalk SpaceTalk is a forum where people can talk about our vast universe. It contains all functionalities that a major forum does. Functionalities

Henrique Ferreira 1 Oct 18, 2021
A fast PHP slug generator and transliteration library that converts non-ascii characters for use in URLs.

URLify for PHP A fast PHP slug generator and transliteration library, started as a PHP port of URLify.js from the Django project. Handles symbols from

Aband*nthecar 667 Dec 20, 2022
Library for free use Google Translator. With attempts connecting on failure and array support.

GoogleTranslateForFree Packagist: https://packagist.org/packages/dejurin/php-google-translate-for-free Library for free use Google Translator. With at

Yurii De 122 Dec 23, 2022
Give thanks (in the form of a GitHub ★) to your fellow PHP package maintainers

Give thanks (in the form of a GitHub ★ ) to your fellow PHP package maintainers (not limited to Symfony components)! Install Install this as any other

Symfony 7.8k Jan 9, 2023
A PHP string manipulation library with multibyte support. Compatible with PHP 5.4+, PHP 7+, and HHVM.

A PHP string manipulation library with multibyte support. Compatible with PHP 5.4+, PHP 7+, and HHVM. s('string')->toTitleCase()->ensureRight('y') ==

Daniel St. Jules 2.5k Dec 28, 2022
"結巴"中文分詞:做最好的 PHP 中文分詞、中文斷詞組件。 / "Jieba" (Chinese for "to stutter") Chinese text segmentation: built to be the best PHP Chinese word segmentation module.

jieba-php "結巴"中文分詞:做最好的 PHP 中文分詞、中文斷詞組件,目前翻譯版本為 jieba-0.33 版本,未來再慢慢往上升級,效能也需要再改善,請有興趣的開發者一起加入開發!若想使用 Python 版本請前往 fxsjy/jieba 現在已經可以支援繁體中文!只要將字典切換為 bi

Fukuball Lin 1.2k Dec 31, 2022
highlight.php is a server-side syntax highlighter written in PHP that currently supports 185 languages

highlight.php is a server-side syntax highlighter written in PHP that currently supports 185 languages. It's a port of highlight.js by Ivan Sagalaev that makes full use of the language and style definitions of the original JavaScript project.

Geert Bergman 633 Dec 27, 2022
Mobile_Detect is a lightweight PHP class for detecting mobile devices (including tablets). It uses the User-Agent string combined with specific HTTP headers to detect the mobile environment.

Motto: "Every business should have a detection script to detect mobile readers." About Mobile Detect is a lightweight PHP class for detecting mobile d

Şerban Ghiţă 10.2k Jan 4, 2023
A PHP library for generating universally unique identifiers (UUIDs).

ramsey/uuid A PHP library for generating and working with UUIDs. ramsey/uuid is a PHP library for generating and working with universally unique ident

Ben Ramsey 11.9k Jan 8, 2023
👮 A PHP desktop/mobile user agent parser with support for Laravel, based on Mobiledetect

Agent A PHP desktop/mobile user agent parser with support for Laravel, based on Mobile Detect with desktop support and additional functionality. Insta

Jens Segers 4.2k Jan 5, 2023
A lightweight php class for formatting sql statements. Handles automatic indentation and syntax highlighting.

SqlFormatter A lightweight php class for formatting sql statements. It can automatically indent and add line breaks in addition to syntax highlighting

Jeremy Dorn 3.9k Jan 1, 2023
A PHP string manipulation library with multibyte support

A PHP string manipulation library with multibyte support. Compatible with PHP 5.4+, PHP 7+, and HHVM. s('string')->toTitleCase()->ensureRight('y') ==

Daniel St. Jules 2.5k Jan 3, 2023
A sane interface for php's built in preg_* functions

Making regex great again Php's built in preg_* functions require some odd patterns like passing variables by reference and treating false or null valu

Spatie 1.1k Jan 4, 2023
🉑 Portable UTF-8 library - performance optimized (unicode) string functions for php.

?? Portable UTF-8 Description It is written in PHP (PHP 7+) and can work without "mbstring", "iconv" or any other extra encoding php-extension on your

Lars Moelleken 474 Dec 22, 2022
ColorJizz is a PHP library for manipulating and converting colors.

#Getting started: ColorJizz-PHP uses the PSR-0 standards for namespaces, so there should be no trouble using with frameworks like Symfony 2. ###Autolo

Mikeemoo 281 Nov 25, 2022
🔡 Portable ASCII library - performance optimized (ascii) string functions for php.

?? Portable ASCII Description It is written in PHP (PHP 7+) and can work without "mbstring", "iconv" or any other extra encoding php-extension on your

Lars Moelleken 380 Jan 6, 2023
:clamp: HtmlMin: HTML Compressor and Minifier via PHP

??️ HtmlMin: HTML Compressor and Minifier for PHP Description HtmlMin is a fast and very easy to use PHP library that minifies given HTML5 source by r

Lars Moelleken 135 Dec 8, 2022
Extensive, portable and performant handling of UTF-8 and grapheme clusters for PHP

Patchwork UTF-8 for PHP Patchwork UTF-8 gives PHP developpers extensive, portable and performant handling of UTF-8 and grapheme clusters. It provides

Nicolas Grekas 80 Sep 28, 2022
PHP library to parse urls from string input

Url highlight - PHP library to parse URLs from string input. Works with complex URLs, edge cases and encoded input. Features: Replace URLs in string b

Volodymyr Stelmakh 77 Sep 16, 2022