{"id":36980777,"url":"https://github.com/folded-php/crypt","last_synced_at":"2026-01-13T22:50:33.273Z","repository":{"id":62506122,"uuid":"296407462","full_name":"folded-php/crypt","owner":"folded-php","description":"Encrypt and decrypt strings for your web app.","archived":false,"fork":false,"pushed_at":"2020-10-17T07:53:49.000Z","size":44,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-14T04:28:06.894Z","etag":null,"topics":["decryption","encryption","php"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/folded/crypt","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/folded-php.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":"2020-09-17T18:16:59.000Z","updated_at":"2020-10-12T20:10:42.000Z","dependencies_parsed_at":"2022-11-02T12:45:46.736Z","dependency_job_id":null,"html_url":"https://github.com/folded-php/crypt","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/folded-php/crypt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/folded-php%2Fcrypt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/folded-php%2Fcrypt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/folded-php%2Fcrypt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/folded-php%2Fcrypt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/folded-php","download_url":"https://codeload.github.com/folded-php/crypt/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/folded-php%2Fcrypt/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28402164,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T14:36:09.778Z","status":"ssl_error","status_checked_at":"2026-01-13T14:35:19.697Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["decryption","encryption","php"],"created_at":"2026-01-13T22:50:32.671Z","updated_at":"2026-01-13T22:50:33.254Z","avatar_url":"https://github.com/folded-php.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# folded/crypt\n\nEasily encrypt and decrypt strings for your web app.\n\n[![Build Status](https://travis-ci.com/folded-php/crypt.svg?branch=master)](https://travis-ci.com/folded-php/crypt) [![Maintainability](https://api.codeclimate.com/v1/badges/8e59f7e6108adc65ca6b/maintainability)](https://codeclimate.com/github/folded-php/crypt/maintainability) [![TODOs](https://img.shields.io/endpoint?url=https://api.tickgit.com/badge?repo=github.com/folded-php/crypt)](https://www.tickgit.com/browse?repo=github.com/folded-php/crypt)\n\n## Summary\n\n- [About](#about)\n- [Features](#features)\n- [Requirements](#requirements)\n- [Installation](#installation)\n- [Examples](#examples)\n- [Version support](#version-support)\n\n## About\n\nI created this library to be able to encrypt my data in a standalone way.\n\nFolded is a constellation of packages to help you setting up a web app easily, using ready to plug in packages.\n\n- [folded/action](https://github.com/folded-php/action): A way to organize your controllers for your web app.\n- [folded/config](https://github.com/folded-php/config): Configuration utilities for your PHP web app.\n- [folded/exception](https://github.com/folded-php/exception): Various kind of exception to throw for your web app.\n- [folded/history](https://github.com/folded-php/history): Manipulate the browser history for your web app.\n- [folded/http](https://github.com/folded-php/http): HTTP utilities for your web app.\n- [folded/orm](https://github.com/folded-php/orm): An ORM for you web app.\n- [folded/request](https://github.com/folded-php/request): Request utilities, including a request validator, for your PHP web app.\n- [folded/routing](https://github.com/folded-php/routing): Routing functions for your PHP web app.\n- [folded/session](https://github.com/folded-php/session): Session functions for your web app.\n- [folded/view](https://github.com/folded-php/view): View utilities for your PHP web app.\n\n## Features\n\n- Can encrypt and decrypt strings\n- Can generate a key (necessary to setup the library) from the command line\n\n## Requirements\n\n- PHP \u003e= 7.4.0\n- Composer installed\n\n## Installation\n\n- [1. Install the package](#1-install-the-package)\n- [2. Generate a key](#2-generate-a-key)\n- [3. Add the setup code](#3-add-the-setup-code)\n\n### 1. Install the package\n\nIn your root folder, run this command:\n\n```bash\ncomposer require folded/crypt\n```\n\n### 2. Generate a key\n\nOne way to generate the key easily is through the command line. Run this command to get a new key:\n\n```bash\nvendor/bin/crypt generate key\n```\n\nYou can get more information on the available option by running `vendor/bin/crypt generate --help`.\n\nAnother way is to call the function `Folded\\getEncryptionKey()` from a script:\n\n```php\nuse function Folded\\getEncryptionKey;\n\nrequire __DIR__ . \"/vendor/autoload.php\";\n\necho getEncryptionKey();\n```\n\nYou can add a parameter to control the type of cipher you want (currently supported: AES-128-CBC and AES-256-CBC).\n\n### 3. Add the setup code\n\nBefore calling the library, add this setup code as early as possible:\n\n```php\nuse function Folded\\setEncryptionKey;\n\nsetEncryptionKey(\"xIYrZSsCV6hx9x/Q4bka1PejU+aSaMerJQFSYr3QnTE=\");\n```\n\n## Examples\n\n- [1. Encrypt a string](#1-encrypt-a-string)\n- [2. Decrypt a string](#2-decrypt-a-string)\n\n### 1. Encrypt a string\n\nIn this example, we will get the encrypted version of a string.\n\n```php\nuse function Folded\\getEncryptedString;\n\n$encryptedText = getEncryptedString(\"hello world\");\n```\n\n### 2. Decrypt a string\n\nIn this example, we will decrypt a previously encrypted text.\n\n```php\nuse function Folded\\getDecryptedString;\n\n$encryptedString = \"...\";\n$decryptedString = getDecryptedString($encryptedString);\n```\n\nNote it will only decrypt encrypted string from the `getEncryptedString()` function.\n\nAlso note that if you encrypt a string with a key A, and you change the key A for a new key, the `getDecryptedString` will not be able to successfuly decrypt the text and get the original text so be careful to save your key in somewhere safe (generally in a .env file).\n\n## Version support\n\n|        | 7.3 | 7.4 | 8.0 |\n| ------ | --- | --- | --- |\n| v0.1.0 | ❌  | ✔️  | ❓  |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffolded-php%2Fcrypt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffolded-php%2Fcrypt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffolded-php%2Fcrypt/lists"}