Giter Club home page Giter Club logo

kirby3-random's Introduction

Kirby 3 Random

Release Downloads Build Status Coverage Status Maintainability Twitter

Kirby Tag and Page Method to generate various random values.

Commerical Usage


Support open source!

This plugin is free but if you use it in a commercial project please consider to sponsor me or make a donation.
If my work helped you to make some cash it seems fair to me that I might get a little reward as well, right?

Be kind. Share a little. Thanks.

โ€ Bruno
ย 
M O N E Y
Github sponsor Patreon Buy Me a Coffee Paypal dontation Hire me

Installation

  • unzip master.zip as folder site/plugins/kirby3-random or
  • git submodule add https://github.com/bnomei/kirby3-random.git site/plugins/kirby3-random or
  • composer require bnomei/kirby3-random

Usage

Regex/Info Kirbytag Page-Method Static
[0-9]{1,3} (random: 999 generator: number) $page->random(999) Random::number(0, 999)
[0-9]{1} (random: 0, 9 generator: between) $page->random([0, 9], 'between') Random::between([0, 9])
(\d\w){5,10} (random:) $page->random() Random::string()
\d{5} (random: 5 generator: num) $page->random(5, 'num') Random::string(5, 'num')
(apple OR banana OR coconut) (random: apple, banana, coconut generator: pick) $page->random('apple, banana, coconut', 'pick') Random::pick(['apple', 'banana', 'coconut'])
5 chars (random: chars generator: lorem length: 5) $page->random('chars', 'lorem', 5) Random::lorem(5, 'chars')
5 words (random: words generator: lorem length: 5) $page->random('words', 'lorem', 5) Random::lorem(5, 'words')
5 sentences (random: sentences generator: lorem length: 5) $page->random('sentences', 'lorem', 5) Random::lorem(5, 'sentences')
5 [paragaph PHP_EOL PHP_EOL] (random: paragraphs generator: lorem length: 5) $page->random('paragraphs', 'lorem', 5) Random::lorem(5, 'paragraphs')
[a-zA-Z0-9]{40} (random: generator: token) $page->random(null, 'token') Random::token()
[A-Z0-9]{12} (random: alphaupper, num generator: token length: 12) $page->random('alphaupper, num', 'token', 12) Random::token(12, 'alphaupper, num')

Markdown tables do not allow | in regex so i wrote OR instead. For all random numbers the cryptographically safe PHP 7 function rand_int is used. Bnomei\Random can be used as Random if use Bnomei\Random; is included at the head of the PHP script.

Dependencies

Disclaimer

This plugin is provided "as is" with no guarantee. Use it at your own risk and always test it yourself before using it in a production environment. If you find any issues, please create a new issue.

License

MIT

It is discouraged to use this plugin in any project that promotes racism, sexism, homophobia, animal abuse, violence or any other form of hate speech.

kirby3-random's People

Contributors

bnomei avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

kirby3-random's Issues

Idea: Add Faker

There are so many different types of random content implemented in PHP Faker, just saw it and thought it could be a nice fit.

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.