TLDR #4 - October 2021

October 13, 2021 MrAnyx 5 min de lecture

📚 TLDR (Too Long; Don't Read) is a monthly post to help you discover some great and innovative github projects, youtube channels or blog posts.

Today's episode is about : a data generation CLI, a library to easily create Discord bots, a documentation website generator, a tiny PHP framework based on Laravel components and two ways to create unique identifiers (Uuid).

Fony (Github)

Fony is, in simple words, a data generator CLI that will help you create fake data for a project or an API. This library is kind of like Faker in PHP or faker.js in javascript except that the data will be generated via a command in your terminal rather than in a program that we will then have to execute.

This library is powered by Chancejs, another library that generates a random name, age, ip, and so on.

Thanks to Fony, the data generation process to feed a database for example is very fast and very simple.

Using only one command, you will be able to generate thousands of data on a JSON format. Awesome 👍

Discordjs (Github)

Discordjs is pretty well known by developers that creates Discord bots. With over 15k stars on Github (as I write this article), Discordjs allows you to access the Discord API with a lot of ease using NodeJS. You can actually create simple bots that respond to certain types of messages, or you can create much more complex bots with database interaction, external API calls, and so on. The field of possibilities is almost endless.

It works with the principle of events that Discord emits and that we will be able to catch in order to execute a certain logic according to the event.

Docsify (Github)

You want to create a user-friendly documentation website with a good user interface but you don't want to spend time creating it from scatch ? Well, Docsify is made for you. With minimal configuration, you will be able to create beautiful documentation pages. It uses markdown so that you can easily and quickly add content. It also has multiple plugins available made by the community so that you can customize you documentation.

Personally, I have been using it since 2019 and I find this framework really quick and easy to use. I highly recommend it 👍

Lumen (Lumen)

If you know the Laravel environment, you probably already know Lumen. So, Lumen is a tiny PHP framework based on the Laravel mega framework. Which means, most a Laravel packages are available with Lumen (because it based on the same thing).

This framework will help you create minimal PHP applications using less code. Indeed, it comes with the most common tasks of web projects like : routing, database abstraction layer or caching, so you won't need to create these things by yourself.

Uuid (Github)

Well, Uuids are becoming more and more populary. Developers use them in many ways to, for example, identify a resource, create unique identifiers for databases and so on. In other words, Uuids are used to uniquely identify something.

The first library that I want to share with you is extremely popular in the PHP developer community. It is simply called Uuid and it was made by a great developer : Ben Ramsey. It allows you to, very easily, create unique identifiers based on time, name or just something completly random. Here is an example of how you can use it.

use Ramsey\Uuid\Uuid;

$uuid = Uuid::uuid4();

printf(
    "UUID: %s\nVersion: %d\n",
    $uuid->toString(),
    $uuid->getFields()->getVersion()
);

// Result : 
// UUID: 1ee9aa1b-6510-4105-92b9-7171bb2f3089
// Version: 4

This library is also trusted by big companies like Symfony or Laravel. Indeed, it is used to create unique identifiers with Doctrine (for Symfony) or Eloquent (for Laravel).

But, Uuids are, obviously, random and very hard to read and remember. That's why I want to share with you a second libary called uuid-readable. The purpose of this one is to create readable identifiers. It will create random, unique and readable phrases that are Shakespearean and grammatically correct. You can use it a NodeJS project or even using cURL 🎉.

const id = require('uuid-readable')

console.log( id.generate() )
// Cathleen d Dieball the Monolith of Alderson reflects Arly Arnie Keenan and 18 large ants
curl https://uuid.rocks/plain?readable
# Joyce Ange Barrett the Orient of Alco killed Marlyn Hewett Lady and 11 strong bulls

You should definitly take a look at these two libraries.

Ramsey/uuid :

Uuid-readable :

Cover by : fauxels


Cette œuvre est mise à disposition selon les termes de la licence Licence Creative Commons