Giter Site home page Giter Site logo

readable-url's Introduction

Logo

All Contributors

Generate readable random phrases for URLs

Badge Badge Badge Badge Badge Badge Badge Badge


How To Use

This library is available on packagist. To install,

composer require hyungju/readable-url

Then create ReadableURL Class

$readableURL = new HyungJu\ReadableURL();

You can pass four parameters to the class.

use HyungJu\ReadableURL;
// Takes 4 parameters.
// 1. A boolean value - If true, returns string in CamelCase, else lowercase.
// 2. An integer value - The number of words to be generated in the string. (Between 2 and 10).
// 3. A string - The seperator between the words.
// 4. Language Class - Currently Supported : HyungJu\Language\En, HyungJu\Language\Ko. pass language instance! the default is HyungJu\Language\En
$readableURL = new ReadableURL();
//$readableURL = new HyungJu\ReadableURL(false, 5, '-', new HyungJu\Language\Ko()); // Other options.

To generate ReadableURL, call the generate() function.

use HyungJu\ReadableURL;

...

$readableURL = new ReadableURL();
$readableURL->generate();
// > QuickScrawnyCamp

In addition, the following are simple to:

use HyungJu\ReadableURL;

...

$str = ReadableURL::gen();
// > FierceSaltyComparison

This can be used to add to the end of a URL.

Example: https://example.com/photos/ForgetfulHarshEgg

For best results, use an integer value of 3, 4, or 5.

Test

composer test

Adding new language

  1. Add wordsets to src/words/[language code]. adjectives.txt and nouns.txt are needed.

  2. Create your language class src/Language/[language code].php. the class name must be started with Uppercase.

  3. Implement the class based on other languages already implemented (korean and english)

  4. Register your language in src/Language/LanguageHelper.php.

  5. (optional) Add test for your language.

Versioning

We use SemVer for versioning this project.

License

MIT License

Contributors ✨

Thanks goes to these wonderful people (emoji key):


도다

💻

Yukihyõ

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

readable-url's People

Contributors

allcontributors[bot] avatar ddarkr avatar hyungju avatar julianotten avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

julianotten

readable-url's Issues

Non-Latin language support

Currently non-latin language (e.g. Korean(ko) ) is also implementing isVowel()method that only affects latin based languages.

  • refactor generate method like sharadbhat/ReadableURL#6
  • then implement non-latin language option without vowel glue or other english specific options
  • custom rules for languages

I wrote this issue in english because I've mentioned the other PR that is in english, so that they could understand what I am doing!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.