{"id":20948908,"url":"https://github.com/kaiopiola/keygen-package","last_synced_at":"2025-05-14T02:30:55.297Z","repository":{"id":44931177,"uuid":"447194746","full_name":"kaiopiola/keygen-package","owner":"kaiopiola","description":"Pattern-based key generator","archived":false,"fork":false,"pushed_at":"2024-05-14T14:15:44.000Z","size":36,"stargazers_count":13,"open_issues_count":2,"forks_count":5,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-23T16:39:23.901Z","etag":null,"topics":["keygen","keygeneration","keygenerator","keygens","php"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/kaiopiola/keygen","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kaiopiola.png","metadata":{"files":{"readme":"README.MD","changelog":"CHANGELOG.MD","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-01-12T11:39:51.000Z","updated_at":"2024-05-14T14:15:47.000Z","dependencies_parsed_at":"2022-09-15T21:01:04.849Z","dependency_job_id":null,"html_url":"https://github.com/kaiopiola/keygen-package","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaiopiola%2Fkeygen-package","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaiopiola%2Fkeygen-package/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaiopiola%2Fkeygen-package/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaiopiola%2Fkeygen-package/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kaiopiola","download_url":"https://codeload.github.com/kaiopiola/keygen-package/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225272351,"owners_count":17447922,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["keygen","keygeneration","keygenerator","keygens","php"],"created_at":"2024-11-19T00:26:28.243Z","updated_at":"2024-11-19T00:26:28.709Z","avatar_url":"https://github.com/kaiopiola.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Keygen\n\n\u003ca target=\"_blank\" href=\"https://packagist.org/packages/kaiopiola/keygen\" \u003e\u003cimg src=\"https://img.shields.io/packagist/dt/kaiopiola/keygen?color=%2300FFF\" /\u003e\u003c/a\u003e\n\u003ca target=\"_blank\" href=\"https://packagist.org/packages/kaiopiola/keygen\" \u003e\u003cimg src=\"https://img.shields.io/packagist/v/kaiopiola/keygen?color=%23888888\u0026label=version\" /\u003e\u003c/a\u003e\n\u003ca target=\"_blank\" href=\"https://packagist.org/packages/kaiopiola/keygen\" \u003e\u003cimg src=\"https://img.shields.io/packagist/php-v/kaiopiola/keygen\" /\u003e\u003c/a\u003e\n\n### Essa documentação está disponível também em [Português do Brasil](README_pt-BR.MD).\n\n***If you find any bug, feel free to [create a new issue](https://github.com/kaiopiola/keygen-package/issues/new?labels=bug)!***\n\nThe Keygen plugin is a key or serial generator based on user-defined mask patterns.\nThe plugin is able to generate keys like the example below:\n\n```6W2F-4RJB-KV0Z-ADA6-4SJ2```\n\nIt can be used to generate keys for several purposes, some examples are:\n\n\u003cul\u003e\n   \u003cli\u003eUnique links to reset passwords\u003c/li\u003e\n   \u003cli\u003eRegistration via invitation link\u003c/li\u003e\n   \u003cli\u003eTwo-Factor authentication codes\u003c/li\u003e\n   \u003cli\u003eFile sharing links\u003c/li\u003e\n   \u003cli\u003eProduct redemption keys\u003c/li\u003e\n   \u003cli\u003eDiscount coupons\u003c/li\u003e\n   \u003cli\u003eReferral codes\u003c/li\u003e\n\u003c/ul\u003e\n\n## Installation\n\nFisrt, run the following command in your project:\n\n``` console\ncomposer require kaiopiola/keygen\n```\n\nThen, call the main class on the PHP file you want to load it:\n\n``` php\nuse Kaiopiola\\Keygen\\Key;\n```\n\n## How Keygen works\n\n### How to create a new key\n\nTo create a new key, just instantiate the class in a variable, and then define its configuration parameters, as shown in the example below:\n\n``` php\n# Instantiating class in a variable:\n$exampleKey = new Key;\n\n# Setting parameters:\n$exampleKey-\u003esetPattern(\"XXXX-NNNN-LLLL\"); // Defines the pattern that the code will use to define its new key. \n// The letters represent the type of content that can be used in that space, as per the rule:\n// X - Any letter or number\n// N - Numbers only as defined\n// L - Letters only as defined\n// Any other characters like dashes, dots, slashes, and even other letters and numbers, will not be replaced.\n// If this property is not defined, the following will be used by default: XXXXX-XXXXX-XXXXX\n\n$exampleKey-\u003esetNumbers(\"789\"); // Defines the numbers that can compose your key, if not defined, it will use by default \"0123456789\"\n$exampleKey-\u003esetLetters(\"ABC\"); // Defines the letters that can compose your key, if not defined, it will use by default \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\"\n\n$exampleKey-\u003egenerate(); // Generate your key and return a string value with the result\n```\n\n### How to create a new unique key\n\nYou also have the option to generate an unique key to avoid duplicates, using the example below:\n\n``` php\n$exampleKey-\u003esetExistingKeys([]); // Defines the existing keys that the code will avoid duplicates. Must be type array.\n\n$exampleKey-\u003egenerateUnique(); // Generate your key and return a string value with the result\n```\nThis is also compatible with ```setPattern```, ```setNumbers``` and ```setLetters``` too!\n\n## Considerations\n\nThis project is open to contributions, whether with suggestions or improvements to the code of any kind.\nFeel free to participate in its development.\n\n## License\nMIT License (MIT). Please, read the [License File](LICENSE) for more informations.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaiopiola%2Fkeygen-package","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkaiopiola%2Fkeygen-package","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaiopiola%2Fkeygen-package/lists"}