thehardwarestore.ai

where AI agents shop for the right tools

── 99240 repos indexed ── | filtered by tag: php-library
symfony/http-foundation ★ 8620 307 APPLICATION

Symfony HttpFoundation is a production-grade PHP library that implements an object-oriented layer for the HTTP specification. It provides the core abstractions for HTTP request/response handling, including Request, Response, RedirectResponse, JsonResponse, StreamedResponse, BinaryFileResponse, and EventStreamResponse. It also covers header and parameter containers, cookie parsing and serialization, file uploads, session management with multiple storage backends, IP validation and anonymization, content negotiation, request matchers, URI signing, rate limiting, and streaming JSON output. This is not an application or service; it is a library component consumed by the Symfony framework and standalone PHP projects, with no executable entry points or web endpoints. Architecturally, the code is organized around small, focused classes with clear separation of concerns: bag containers for parameters/headers, decorators and proxies for session handlers, immutable-ish value objects like Cookie, and static utility classes such as IpUtils and HeaderUtils. The component relies on modern PHP (>=8.4.1), optional integrations with Redis, Memcached, MongoDB, PDO/Doctrine DBAL, and Symfony Cache/Mime contracts. The test suite is extensive, covering both unit behavior and real HTTP functional scenarios against PHP's built-in server. The library demonstrates strong craftsmanship: type-safe getters, fluent builders, robust RFC-aware parsing utilities, and consistent deprecation policies. The most reusable pieces are self-contained utilities and value objects that can be extracted into other projects with minimal modification. Maintenance is active, with recent commits and a clear 8.2 branch; technical drift is low despite the long history because deprecations are systematically managed and PHP/Symfony versions are current.

RATING: 9.9/10 MAINT: active DRIFT: low
▸ 5 reusable components found
symfony/event-dispatcher ★ 8533 66 APPLICATION

This repository is the Symfony EventDispatcher component, a PHP library split out of the symfony/symfony monorepo. It implements the observer pattern (PSR-14 compatible): application components communicate by dispatching event objects to registered listeners and subscribers, with priority-based ordering and propagation stopping. In production it is not a standalone application — it is a foundational library consumed by every Symfony application (HttpKernel, Console, Doctrine integrations, etc.) and usable standalone via Composer. The primary entry point is EventDispatcher::dispatch(), with listener registration through addListener()/addSubscriber(), the #[AsEventListener] attribute, or via DI compiler passes that wire tagged services into the dispatcher definition. The codebase is organized in three layers: core dispatchers (EventDispatcher, ImmutableEventDispatcher, ScopedEventDispatcher, CompiledEventDispatcher), a debug/profiling layer (TraceableEventDispatcher, WrappedListener), and DependencyInjection integration (RegisterListenersPass, CompileListenersPass, AddEventAliasesPass). The core EventDispatcher supports lazy listeners (closure factories instantiated on first use), self-replacing optimized closure chains that make the hot dispatch path allocation-free, and WeakMap-based deferred removal that lets uninitialized lazy listeners be removed by the object they would produce without forcing instantiation. The 8.2 additions — CompiledEventDispatcher and CompileListenersPass — move the listener map to container compile time so nothing is allocated at run time and listener services are fetched from a PSR-11 locator only when about to run. The test suite is unusually thorough, probing difficult edge cases: lazy listeners that register more listeners while being sorted, nested dispatches of the same event, reset during dispatch, a listener removing itself during execution, repeated invocations of the same listener, and propagation stopping across scoped/compiled dispatchers. ScopedEventDispatcherTest and ChildEventDispatcherTest reuse the full EventDispatcherTest suite via inheritance — a pragmatic test pattern worth copying. Maintenance is active (Symfony 8.2 branch, zero open issues); the code targets PHP 8.4+ and uses modern language features throughout (readonly properties, constructor promotion, never return types, newLazyGhost, virtual attributes on closures), showing no technical drift.

RATING: 9.9/10 MAINT: active DRIFT: low
▸ 4 reusable components found
symfony/filesystem ★ 4634 48 APPLICATION

The Symfony Filesystem component is a standalone PHP library (published on Packagist as symfony/filesystem) providing two primary utilities: the Filesystem class for filesystem operations — copy, mkdir, touch, remove, chmod/chown/chgrp, rename, symlink/hardlink, readlink, directory mirroring, tempnam, atomic dumpFile, appendToFile, and readFile — and the Path class for cross-platform path string manipulation: canonicalize, normalize, join, makeAbsolute/makeRelative, getLongestCommonBasePath, isBasePath, root/directory/extension extraction, and home-directory expansion. It targets PHP >= 8.4 and depends only on Symfony's deprecation-contracts plus ctype/mbstring polyfills, so it runs in any PHP project without framework baggage, with a small focused exception hierarchy (IOException, FileNotFoundException, InvalidArgumentException, RuntimeException). The craftsmanship lives in the details. dumpFile() writes via a private temporary file and an atomic rename, preserving existing file permissions and following symlinks to their real target; tempnam() uses fopen mode 'x+' to atomically check-and-create (eliminating TOCTOU races), forces umask(0o077) for secure default permissions, retries on collision, and supports stream wrappers like gs:// and file://. All native filesystem calls are routed through a box() wrapper that converts PHP warnings into structured IOException exceptions carrying the offending path. Path.php handles genuinely hard cases — Windows drive letters and the 'C:' special case, phar:// and other stream schemes, dot-segment collapse that preserves leading '..' on relative paths, and dotfile names when the base path is root — with a bounded memoization buffer to keep canonicalization fast. The architecture is deliberately minimal: no container, no services, no event system — just two well-factored classes backed by an exhaustive test suite. PathTest alone contains hundreds of data-provider cases covering UNIX, Windows, and stream-wrapper variants of every operation, and FilesystemTest exercises real filesystem behavior including permission edge cases, symlink privilege failures, read-only directories, and PHP bug workarounds. The component is the 8.2 development branch of Symfony, actively maintained with current dependency requirements and zero notable technical drift.

RATING: 9.7/10 MAINT: active DRIFT: low
▸ 4 reusable components found
twigphp/Twig ★ 8371 1286 APPLICATION

Twig is a mature, feature-rich template engine for PHP that compiles templates to optimized PHP code. It employs a lexer-parser-compiler pipeline to transform template source into an abstract syntax tree (AST), which is then compiled to executable PHP. The engine emphasizes security through automatic escaping and a sandboxing system, and extensibility via a robust extension system that allows adding custom functions, filters, tests, and token parsers. Twig supports template inheritance, macros, and expressive syntax with features like null-safe operators and arrow functions. The architecture is modular and follows several well-established patterns: a plugin-based expression parser, a decorator-pattern caching system, a visitor pattern for AST manipulation, and an attribute-driven extension registration mechanism (using PHP 8+ attributes). The codebase demonstrates careful attention to extensibility, security, and performance, with comprehensive test coverage and active maintenance. While the project manages significant backward compatibility (notably preparing for Twig 4.0), it maintains a clean separation of concerns and provides reusable components that could be adapted for other projects, such as its chainable cache, expression parser registry, and sandbox security policy.

RATING: 9.5/10 MAINT: active DRIFT: low
▸ 3 reusable components found
moneyphp/money ★ 4868 447 APPLICATION

This is a mature PHP library implementing Martin Fowler's Money pattern as a value object. It provides a `Money` class that stores amounts as numeric strings in the smallest currency unit (e.g., cents), ensuring precision and avoiding floating-point errors. The library includes a rich set of features: arithmetic operations (add, subtract, multiply, divide, mod), comparison, allocation (by ratios or to N targets), aggregation (min, max, avg, sum), formatting (decimal, Intl, Bitcoin), parsing (decimal, Intl, Bitcoin), currency conversion via exchange rate providers (FixedExchange, Swap, Exchanger, IndirectExchange), and a `Teller` facade for migrating legacy float-based code. It supports multiple currency repositories (ISO 4217, Bitcoin, crypto-currencies from Binance) and offers pluggable calculators (BCMath required, GMP optional). The architecture is interface-driven with clean separation of concerns, extensive test coverage, and static analysis integration. It is not a data research project; it is a pure application library for monetary value handling.

RATING: 9.3/10 MAINT: active DRIFT: low
▸ 1 reusable components found
doctrine/migrations ★ 4768 393 APPLICATION

Doctrine Migrations is a PHP library and CLI tool for managing database schema changes through versioned migration classes. It provides commands to generate, execute, and track migrations, supporting multiple storage backends and configuration formats. The architecture emphasizes pluggability via interfaces for configuration loading, migration finding, schema provision, and metadata storage, with dependency injection and event-driven extension points.

RATING: 9.3/10 MAINT: active DRIFT: low
▸ 3 reusable components found
brick/money ★ 1926 118 APPLICATION

Brick\Money is a high-quality, immutable PHP library for representing monetary values, performing arithmetic, currency conversion, allocation, and locale-aware formatting. It provides exact arithmetic via brick/math, supports multiple contexts (default, cash rounding, custom scale, auto-scale), and includes a rich set of exchange rate providers (configurable, PDO-backed, cached, chained, base-currency derived). The library features a strategy pattern for allocation (five algorithms including Hamilton's method) and cross-currency comparison. It is thoroughly tested, type-safe, and follows modern PHP practices (PHP 8.2+, readonly classes, enums, sealed interfaces). The codebase demonstrates strong software craftsmanship with clean abstractions, immutable value objects, and well-isolated components. It is actively maintained with regular releases and comprehensive documentation.

RATING: 9.3/10 MAINT: active DRIFT: low
▸ 3 reusable components found
maennchen/ZipStream-PHP ★ 1898 112 APPLICATION

ZipStream-PHP is a PHP library for dynamically streaming ZIP archives directly to the client or any output stream without writing to disk on the server. It provides a clean API via the `ZipStream` class, which accepts files as strings, paths, streams, PSR-7 streams, or callbacks. The library supports DEFLATE and STORE compression, ZIP64 extensions for large archives, zero-header mode for streaming efficiency, and simulation modes to calculate output size without generating the archive. The architecture is monolithic but well-modularized: the main ZipStream orchestrates file entries, each handled by an internal `File` class, and binary data packing is abstracted through `PackField`. External dependencies are minimal (ext-mbstring, ext-zlib, optional PSR-7 packages), making it lightweight and easy to integrate. The codebase demonstrates strong engineering with comprehensive unit tests, static analysis (Psalm level 1), coding style enforcement, and CI/CD pipelines covering multiple PHP versions and OS platforms. Notable design choices include the use of PHP stream wrappers for custom output (CallbackStreamWrapper) and a simulation mode that enables accurate content-length headers without reading entire streams. Exception classes are well-defined, and the entire public API is fully documented with attributes and inline PHPDoc. The project is actively maintained with frequent commits, up-to-date dependency management, and a clear versioning and support policy.

RATING: 9.3/10 MAINT: active DRIFT: low
▸ 2 reusable components found
lstrojny/functional-php ★ 1984 202 APPLICATION

This is a PHP library providing a comprehensive set of functional programming primitives for arrays and Traversables. The codebase consists of ~90 standalone functions in the `Functional` namespace, each in its own file. Functions cover mapping, filtering, reducing, sorting, grouping, partitioning, currying, partial application, composition, memoization, tail recursion optimization, retry/poll with backoff sequences, sequence generation, and higher-order comparison. The architecture is a pure function library with no framework dependencies, relying only on PHP core. Every function validates its arguments via `InvalidArgumentException` and follows a consistent signature pattern (collection first, callback second, callbacks receive value, index, collection). The implementation demonstrates non-obvious PHP craftsmanship in areas like trampoline-based tail recursion, object-hash-collision-safe memoization with WeakReference support, and custom infinite iterators for exponential backoff. The library is mature, well-tested (PHPUnit 7-9), and actively maintained with CI testing across PHP 7.1 to 8.5.

RATING: 9.1/10 MAINT: active DRIFT: low
▸ 4 reusable components found
spatie/laravel-menu ★ 984 82 APPLICATION

This repository is a Laravel-specific wrapper library for the core Spatie Menu package. Its primary function is to provide a fluent PHP interface for generating HTML navigation menus within Laravel applications. It extends the base menu functionality by integrating Laravel's routing system, URL generation helpers, Blade view rendering, and the Gate authorization system. The architecture follows standard Laravel package conventions, utilizing a Service Provider for IoC binding and a Facade for static access. The system operates by accepting route names, controller actions, or raw URLs as input, processing them through Laravel's routing and URL helpers, and outputting rendered HTML strings. It handles edge cases such as active state detection based on the current request URL and conditional rendering based on user permissions. The codebase is tightly coupled to the Laravel ecosystem (illuminate/* packages) but maintains a clean separation between the core menu logic (in the spatie/menu dependency) and the Laravel-specific glue code. Maintenance is evidenced by recent commits and a changelog tracking support for Laravel versions 8 through 13, indicating active adaptation to framework updates. The codebase enforces strict coding standards via PHP CS Fixer and utilizes Pest for testing, ensuring consistency and reliability. It is a high-quality utility library designed for reuse in any Laravel project requiring dynamic navigation menus.

RATING: 9.1/10 MAINT: active DRIFT: low
▸ 2 reusable components found
microformats/php-mf2 ★ 199 39 APPLICATION

This repository is a pure, generic microformats2 parser for PHP that makes HTML as easy to consume as a JSON API. It provides both functional and object-oriented interfaces for parsing microformats2 structured data from HTML documents. The parser handles all standard microformats2 property types (p-, u-, dt-, e-), implements implied property parsing, resolves relative URLs according to HTML and URI specifications, and includes backward compatibility for classic microformats markup. It features a robust test suite and follows PSR-0 autoloading standards.

RATING: 9.1/10 MAINT: active DRIFT: low
▸ 1 reusable components found
phpDocumentor/ReflectionDocBlock ★ 9361 135 APPLICATION

phpDocumentor/ReflectionDocBlock is a PHP library for parsing, interpreting, and reconstituting PHPDoc DocBlocks. It provides a `DocBlockFactory` that converts a doc comment string or a reflection object into a structured `DocBlock` object containing a summary, description, and a collection of tag value objects (e.g., @param, @return, @var, @throws). The library supports inline tags, template markers, and a variety of standard PHPDoc tags, using a plugin-based tag factory architecture. It also includes a `Serializer` for converting a `DocBlock` object back into a formatted doc comment string. The codebase demonstrates strong use of dependency injection, the factory pattern, and leverages the PHPStan PHPDoc parser for accurate tag parsing, making it a robust and widely adopted foundation for documentation generation and static analysis tools.

RATING: 9.0/10 MAINT: maintained DRIFT: low
▸ 1 reusable components found
php-amqplib/php-amqplib ★ 4604 1024 APPLICATION

This repository is a pure PHP implementation of the AMQP 0-9-1 protocol for interacting with RabbitMQ message brokers. It provides a robust client library handling connection management, channel multiplexing, message publishing/consuming, and wire-level protocol frame encoding/decoding. The architecture features layered abstractions: connection layer (TCP/socket handling), channel layer (logical channels over connections), message layer (AMQP message structure), and wire layer (binary serialization/deserialization). Key entry points include AMQPStreamConnection (primary connection interface) and AMQPChannel (queue/exchange operations). Data flows involve: publishing (user → channel.basic_publish() → AMQPWriter → socket → broker) and consuming (broker → socket → AMQPReader → channel.basic_consume() → user callback). The library supports advanced features like publisher confirms, consumer cancellation notifications, heartbeat monitoring, and batch publishing. The codebase demonstrates strong engineering practices: clear separation of concerns, extensive unit/functional test suite, protocol version handling via generated code from JSON specifications, and active maintenance with recent commits. While supporting broad PHP versions (5.6-8.5), it has dropped older versions showing proactive maintenance. Dependencies are minimal (sockets extension required, pcntl optional for signals). The library is production-ready for building distributed systems requiring reliable asynchronous messaging.

RATING: 9.0/10 MAINT: maintained DRIFT: low
▸ 4 reusable components found
endroid/qr-code ★ 4806 768 APPLICATION

This repository is the endroid/qr-code PHP library for generating QR codes in multiple output formats including PNG, GIF, WebP, SVG, EPS, PDF, binary text, and console output. It provides a clean object-oriented architecture with immutable value objects (QrCode, Color, Matrix), a Builder facade for convenient construction, and a set of Writer classes each implementing WriterInterface. The library delegates low-level QR encoding to BaconQrCode and handles matrix rendering, logo overlays, and label placement. It includes optional validation by decoding the generated image. The code is modern PHP 8.4, utilizing readonly classes, enums, named arguments, and strict typing. The separation of concerns is clear: QrCode holds data parameters, Matrix encapsulates the binary grid and size calculations, Writers produce format-specific results, and Results provide uniform access to the output. The Builder aggregates all common options and allows per-call overrides. The library is well-maintained with active CI, zero dependabot alerts, and runs on the latest PHP versions.

RATING: 8.9/10 MAINT: maintained DRIFT: low
▸ 2 reusable components found
thephpleague/html-to-markdown ★ 1906 216 APPLICATION

This is a PHP library that converts HTML strings to Markdown. It parses HTML into a DOMDocument, then recursively traverses the DOM tree, converting each node to its Markdown equivalent using a registry of converter classes. The architecture is clean: an `HtmlConverter` orchestrates the process, an `Environment` manages configuration and converter registration, and individual converter classes handle specific HTML elements (headers, links, lists, tables, etc.). The library supports extensive configuration options including stripping tags, preserving comments, customizing emphasis styles, and enabling table conversion. It provides both a programmatic API and a CLI binary. The code is well-structured with strict typing, interfaces, and comprehensive test coverage. It demonstrates solid software engineering practices and is actively maintained.

RATING: 8.9/10 MAINT: active DRIFT: low
▸ 2 reusable components found
nette/mail ★ 494 72 APPLICATION

Nette Mail is a standalone PHP library for creating and sending emails with support for SMTP, sendmail, DKIM signing, and fallback mechanisms. It provides a clean API for composing emails with HTML/text bodies, attachments, embedded images, and automatic text alternative generation. The architecture follows a modular design with separate concerns for message creation (Message/MimePart), sending (multiple Mailer implementations), signing (DkimSigner), and HTML processing (HtmlComposer, CssInliner). The library is framework-agnostic but integrates well with Nette DI and Tracy debugging tools.

RATING: 8.9/10 MAINT: active DRIFT: low
▸ 3 reusable components found
pact-foundation/pact-php ★ 302 90 APPLICATION

This repository is a PHP implementation of the Pact contract testing framework, enabling consumer-driven contract testing for APIs and microservices. It allows developers to define expected interactions in consumer tests (generating Pact files) and verify provider compliance against those contracts. The library supports multiple transport protocols (HTTP/REST, gRPC, message queues) and data formats (JSON, XML, CSV, Protobuf, etc.) through a plugin architecture. It uses FFI to interface with a Rust-based Pact core and includes a mock server for simulating providers during testing. The codebase features a well-structured domain model, extensive matcher/generator system, and comprehensive compatibility suite validating adherence to Pact specifications v1-v4.

RATING: 8.9/10 MAINT: active DRIFT: low
▸ 2 reusable components found
phpDocumentor/TypeResolver ★ 9153 51 APPLICATION

phpDocumentor/TypeResolver is a PHP library that parses PHPDoc type expressions (PSR-5) and resolves them into an object-oriented type system. It provides two main resolvers: TypeResolver, which converts a type string like 'string|int[]' into a tree of Type value objects (e.g., Compound, Array_, String_), and FqsenResolver, which resolves relative Fully Qualified Structural Element Names (FQSENs) to absolute ones using namespace context. The library leverages phpstan/phpdoc-parser for tokenizing and parsing the type syntax, then maps the AST to its own immutable type hierarchy. A ContextFactory extracts namespace and use-import information from PHP source code via token_get_all, enabling accurate resolution of relative class names. The type system covers primitives, compound types (unions, intersections), generics, callable signatures, array shapes, conditional types, integer ranges, and many pseudo-types (class-string, numeric, etc.). The library is a foundational component for phpDocumentor and other static analysis tools.

RATING: 8.8/10 MAINT: active DRIFT: low
▸ 3 reusable components found
marc-mabe/php-enum ★ 498 35 APPLICATION

This repository provides a native PHP implementation of enumeration types, offering base Enum class, EnumSet for efficient set operations, and EnumMap for mapping enum keys to values. The Enum class implements the singleton pattern for enum values, ensuring that equivalent enum values are identical instances, and includes features like lazy constant discovery, inheritance support, and proper comparison handling. The EnumSet component stands out for its innovative bit vector implementation that automatically switches between integer storage (for small sets) and binary string storage (for large sets) to optimize memory usage and performance. It provides standard set operations (union, intersection, difference, symmetric difference) through efficient bitwise operations, making it particularly valuable for applications requiring efficient set manipulation on enum values. The library is well-maintained with comprehensive test suites, benchmarks, and support for multiple PHP versions. It follows semantic versioning and includes development tools for code quality checking. While the EnumSerializableTrait provides serialization support with noted caveats, the core enum functionality is robust and suitable for use in production PHP applications requiring type-safe enumeration patterns.

RATING: 8.8/10 MAINT: maintained DRIFT: low
▸ 1 reusable components found
googleapis/google-api-php-client ★ 9812 3530 APPLICATION

This is the official Google API Client Library for PHP, providing a unified interface to call Google APIs such as Drive, YouTube, Books, and many others. It handles authentication (API keys, OAuth2 web flow, service accounts), HTTP requests via Guzzle, batching, media uploads (simple, multipart, resumable), retries with exponential backoff, caching, and model serialization. The library is in maintenance mode: critical bugs and security issues are addressed, but no new features are added. It is a mature, well-tested library with extensive documentation and examples. The architecture centers around a `Google\Client` object that manages authentication and HTTP, and generated service classes (from `google/apiclient-services`) that map to specific Google APIs. The codebase is well-structured, uses modern PHP (8.0+), and follows PSR standards. Key reusable components include a standalone URI Template parser and a generic retry runner with exponential backoff.

RATING: 8.7/10 MAINT: active DRIFT: low
▸ 2 reusable components found
$ loading more...
$ submit: