Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Stdlib Laravel Package

hyperf/stdlib

Hyperc/stdlib provides foundational utilities for the Hyperf ecosystem: common helpers, collections, array and string tools, and lightweight polyfills used across components. A small, reusable standard library for building high-performance PHP apps and services.

View on GitHub
Deep Wiki
Context7

[READ ONLY]

Frequently asked questions about Stdlib
Is hyperf/stdlib compatible with Laravel, or is it strictly for Hyperf projects?
hyperf/stdlib is designed exclusively for Hyperf projects and relies on Hyperf’s dependency injection, coroutine model, and PSR-15 middleware. Using it in Laravel would require significant refactoring, such as replacing Hyperf-specific abstractions with Laravel equivalents. For Laravel, consider alternatives like spatie/laravel-package-tools or laravel/helpers.
How do I install hyperf/stdlib in my Hyperf project?
Installation is straightforward via Composer: run `composer require hyperf/stdlib`. No additional configuration is required beyond Hyperf’s existing setup, as the package integrates seamlessly with Hyperf’s core components like the DI container and coroutines. Verify compatibility with your Hyperf version (e.g., 3.x+) in the package’s documentation.
What Laravel version support does hyperf/stdlib have?
hyperf/stdlib does not support Laravel—it is built for Hyperf, a separate high-performance PHP framework. If you’re using Laravel, this package is not applicable. For Laravel-specific utilities, explore packages like laravel/helpers or spatie/laravel-package-tools, which are designed for Laravel’s ecosystem.
Can hyperf/stdlib replace custom utility classes in my Hyperf project?
Yes, hyperf/stdlib is designed to replace or standardize custom utility classes like array helpers, string manipulators, or data transformers. Start by replacing non-critical utilities in a pilot phase, then gradually migrate shared libraries. Use Hyperf’s `make:command` to generate replacements for deprecated custom classes and enforce adoption with PHPStan rules.
Are the utilities in hyperf/stdlib optimized for Hyperf’s async/coroutine model?
Many utilities in hyperf/stdlib are designed to work efficiently with Hyperf’s coroutine model, especially those involving batch processing or async operations. However, not all utilities leverage coroutines—focus on those labeled for async use (e.g., batch data processing helpers). For general-purpose utilities, performance overhead is minimal, as they are stateless and side-effect-free.
How can I enforce the use of hyperf/stdlib across my team’s Hyperf services?
Enforce adoption by marking deprecated custom utilities with `@deprecated` annotations and providing migration guides. Use Composer scripts or PHPStan rules to flag violations, such as calls to old helper methods. Gradually replace shared libraries (e.g., DataTransformer) with hyperf/stdlib equivalents, and consider making the package a mandatory dependency in your team’s template repositories.
Does hyperf/stdlib work with Hyperf’s validation component, or should I stick to hyperf/validation?
hyperf/stdlib can complement hyperf/validation by providing consistent data handling utilities, such as array or string transformations, but it does not replace hyperf/validation’s core validation logic. Use hyperf/validation for rules and validation pipelines, and leverage hyperf/stdlib for preprocessing or post-processing data (e.g., sanitizing inputs before validation).
Are there any performance implications of using hyperf/stdlib in production?
hyperf/stdlib is optimized for performance, with utilities designed to be lightweight and stateless. The package avoids unnecessary abstractions, ensuring minimal overhead. However, always benchmark critical paths in your Hyperf services, especially if using async utilities, to confirm they meet your performance requirements. The package’s MIT license ensures no runtime bloat.
What’s the migration path if I’ve already built custom utilities in Hyperf?
Begin by identifying overlapping utilities between your custom code and hyperf/stdlib. Replace 1-2 non-critical helpers in a pilot service to validate integration. Use Hyperf’s `make:command` to auto-generate replacements for deprecated custom classes, and provide clear migration guides. Gradually phase out old utilities, marking them as `@deprecated` to avoid breaking changes.
How do I handle namespace collisions if my project already has classes like ArrayHelper?
hyperf/stdlib follows Hyperf’s naming conventions to minimize collisions, but conflicts can occur if your project uses identical class names (e.g., `ArrayHelper`). Rename your custom classes to avoid conflicts, or use fully qualified namespaces when referencing hyperf/stdlib utilities. Always check the package’s documentation for reserved namespaces or aliases.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky