# defuse/php-encryption

Simple Encryption in PHP.

Repository: https://github.com/defuse/php-encryption
Canonical: https://ross.abutalabs.com/products/php-encryption
Language: PHP
License: MIT
License Family: permissive
Last push: 2024-01-02T15:04:49+00:00

## Health v2 (maintenance only)
Score: 23/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 0, release rhythm 8, longevity 100
- inputs: {"age_days": 4591, "days_push": 974, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 3867, forks 314 (observed 2026-08-28T04:08:27.702088+00:00)

## What it is
A PHP library for symmetric encryption of strings and files using a key or password, built on OpenSSL. Its API is deliberately designed to be easy to use securely and hard to misuse.

## Use cases
- encrypt sensitive data in a PHP application
- encrypt files with a key in PHP
- password-protect data in PHP
- avoid writing insecure PHP encryption code
- store encrypted user data with a password-derived key

## When to choose
- you need straightforward, well-audited symmetric encryption in PHP
- you want an API that resists common crypto mistakes
- you need both key-based and password-based encryption including file encryption

## When to avoid
- you need asymmetric/public-key encryption
- you are on a modern stack where libsodium (sodium_crypto) is available
- you need advanced features like streaming encryption of very large files or key rotation

## Facets
- artifact type: library
- maturity: maintenance
- function: cryptography, security
- domain: security, developer-tools, web-development
- platform: php, cross-platform
- tags: symmetric-encryption, password-based-encryption, openssl, hard-to-misuse, file-encryption, web-server

## Member repositories
- defuse/php-encryption (main) score 23

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:08:27.702088+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T18:25:50.327218+00:00, confidence not recorded.
  - readme: https://github.com/defuse/php-encryption (fetched 2026-08-28T04:08:27.702088+00:00, sha e870a869edc0)
- Data as of 2026-08-30T08:39:29.467469+00:00.
