Lectern is an async and concurrent rewrite of PHP's Composer package manager in Rust. Built with lots of help from ChatGPT-5 and Claude Sonnet 4[.5].
- β‘ Optimized outdated command with better caching and increased concurrency (50x parallelism)
- π HTTP connection pooling with persistent connections and HTTP/2 multiplexing
- π¦ New commands added: create-project, dump-autoload, run-script, diagnose, clear-cache, depends, prohibits, browse, suggests, fund
- π§ Modular codebase with better organized command structure
- πΎ Improved caching with multi-layered in-memory and disk caching
Lectern is not a complete replacement for Composer just yet! Some things I haven't been able to test (as AI wrote that code), or aren't of high priority.
- Composer compatible plugin system
- Testing of private packages and git repositories
- Implement remaining Composer commands (config, global, archive)
- Further optimize dependency resolver with constraint caching
Lectern significantly outperforms Composer across all common operations. Our benchmarks use hyperfine for accurate performance measurements with automatic cache warm-up and multiple test runs.
Performance Highlights:
- π Install: ~21x faster
- β‘ Update: ~17x faster
- π Outdated: ~152x faster
- π¦ Require: ~18x faster
- β¨ Show: ~24x faster
To run the benchmarks yourself:
./bench.sh
This will:
- Build Lectern in release mode
- Run comprehensive benchmarks comparing Lectern vs Composer
- Generate a detailed report in
BENCHMARK.md
Requirements:
- hyperfine - Install via
cargo install hyperfine
or your package manager - Composer installed and available in PATH
See BENCHMARK.md for the complete benchmark report with detailed timing information and statistical analysis.
- Lectern uses a global user cache directory by default. It will use
$XDG_CACHE_HOME/lectern
when the XDG environment is set, otherwise~/.cache/lectern
. - To clear the cache manually, remove that directory (for example
rm -rf ~/.cache/lectern
).
- A GitHub Actions workflow has been added to publish the crate to crates.io when a GitHub release is published:
.github/workflows/publish.yml
. - You must add a repository secret named
CRATES_IO_TOKEN
(your crates.io API token) for publishing to work. The workflow uses this secret to runcargo publish
.
Installs the dependencies listed in the composer.json
file. Equivalent to composer install
.
Updates the dependencies to the latest versions allowed by the composer.json
file. Equivalent to composer update
.
Checks for outdated dependencies and displays the current and latest versions.
Searches for a package on Packagist and displays relevant results.
Adds a new dependency to the composer.json
file and installs it.
Removes a dependency from the composer.json
file and uninstalls it.
Displays detailed information about a specific package.
Shows the autoloader setup.
Initializes a new project with a composer.json
file.
Lists installed packages and their statuses.
Displays the licenses of installed dependencies.
Validates the composer.json
file for correctness.
Creates a new project from a package (similar to composer create-project
).
Regenerates the autoloader files.
Runs a script defined in composer.json
.
Diagnoses the system to identify common problems.
Clears Lectern's cache (types: all, repo, files).
Shows which packages depend on a given package (similar to composer why
).
Shows which packages prevent installing a given package (similar to composer why-not
).
Opens the package repository URL in your browser.
Shows all suggested packages from installed dependencies.
Shows funding information for installed packages.