Originally published on php2rust.dev — part of the PHP to Rust course. View this lesson on the original site.
Rust isn't just a language, it comes with a standard way to build, test, and depend on libraries. If you've used Composer and Packagist in PHP, you'll find familiar ideas: a package manager, a central registry of crates (libraries), and a shared set of conventions. Here's a quick map of the ecosystem so you know what to expect.
Cargo and crates.io
Cargo is Rust's build tool and package manager. It handles compiling your code, downloading dependencies, running tests, and publishing libraries, similar in role to Composer, but for the whole build pipeline. Every Rust project has a Cargo.toml (like composer.json) that lists dependencies and project metadata.
crates.io is the default registry for Rust libraries (crates). When you add a dependency in Cargo.toml, Cargo fetches it from crates.io (or another source you configure). The ecosystem is open and decentralised: anyone can publish a crate, and the tooling is standard across the community.
Core tooling
- rustup , Installs and manages Rust toolchains (stable, beta, nightly) and target platforms. One command gives you the compiler, Cargo, and standard tools.
- rustfmt , Formats code according to the official style. Like PHP-CS-Fixer or Pint, but built in and opinionated.
- Clippy , A linter that suggests idiomatic Rust and common fixes. Run it regularly; it catches many issues before they become bugs.
You'll use Cargo and rustup from the start; we'll set them up right after the next section.
Libraries that matter for web and backend
Coming from PHP, these crates are the ones you're most likely to meet when building services or APIs:
- Serde , Serialisation and deserialisation (JSON, TOML, and others). The go-to for turning bytes into structs and back. Think of it as a type-safe, zero-copy-friendly counterpart to
json_encode/json_decodewith schema-like guarantees. - Tokio , The dominant async runtime for Rust. It powers concurrent I/O (HTTP, databases, queues) and is the foundation many web and network libraries build on. In PHP you might use workers or async extensions; in Rust, Tokio is the standard choice for async.
- Axum , A web framework built on Tokio and the tower ecosystem. It's ergonomic, type-safe, and fits well with Serde and middleware. A natural place to start if you're building APIs or web backends (similar in spirit to picking a small, focused PHP framework).
- Actix , Another popular web framework, with a different design and strong performance. Both Axum and Actix are production-ready; choice often comes down to style and ecosystem fit.
There are crates for databases, HTTP clients, logging, configuration, and more. As you build projects, you'll add dependencies the same way you do with Composer, declare them in Cargo.toml and use them in your code.
Beyond web: data, CLI, and systems
The ecosystem goes well beyond web development. For data processing and analytics, Polars is a fast, multithreaded DataFrame library (often compared to pandas), built on Apache Arrow. For CLIs, clap is the standard for argument parsing. For systems and embedded work, the standard library and a growing set of crates cover everything from file I/O to safe wrappers around low-level APIs. If you later need to optimise a hot path or move part of a PHP system into Rust, the crates are there.
Community and open source
Rust itself is developed openly (rust-lang.org, GitHub, and the Rust Foundation). The language, Cargo, crates.io, and most of the tools and libraries you'll use are open source. The community emphasises documentation, inclusivity, and shared norms (e.g. the Rust API guidelines). As a PHP developer you're already used to a large, package-based ecosystem; Rust's is smaller but cohesive and well-documented.
What's next
You'll use Cargo and rustup from the start. Once they're on your machine, we'll get to that in a couple of sections, you'll be in a good position to explore crates.io and add dependencies as you need them. Before we install, one more question: why learn Rust?
From PHP to Rust — Getting Started with Rust