Weave 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

Memory Laravel Package

hyperf/memory

Hyperf Memory provides memory-related utilities for Hyperf applications, offering helpers to inspect and manage PHP process memory usage. It integrates with the coroutine framework to help monitor memory limits and support safer, more predictable long-running services.

View on GitHub
Deep Wiki
Context7

An independent component that use to operate and manage memory.

Frequently asked questions about Memory
How do I install hyperf/memory?
Install it with Composer using composer require hyperf/memory. In a Hyperf application the component is discovered through its ConfigProvider, so you can create or publish the memory configuration and then inject the managers via the container. Make sure the Swoole extension is installed and enabled for the runtime.
What is hyperf/memory used for?
It provides lightweight shared-memory utilities for Hyperf applications, wrapping Swoole Table and Atomic primitives with configuration-driven managers. Use it to share data and counters safely across worker processes without running an external service such as Redis. It is intended for fast, in-process shared state rather than durable storage.
Does hyperf/memory work with Laravel?
No, hyperf/memory is built for Hyperf, which is a coroutine-based PHP framework that uses Swoole and its own DI container. It is not a drop-in Laravel package and does not use Laravel's service providers or facades. If you are on Laravel, you would need a different approach or a Swoole integration layer.
How do I configure Swoole Tables in hyperf/memory?
Tables are defined in configuration and created by the component's manager, so you typically declare table names, sizes, and columns in the Hyperf memory config file. The manager then creates or retrieves those table instances through dependency injection. Check the package source or README for the exact config keys because they are not shown in the provided excerpt.
Which PHP, Swoole, and Hyperf versions does hyperf/memory support?
The provided context does not list specific version constraints, so you should check the package composer.json before installing. It requires the Swoole extension and a compatible Hyperf version, because it wraps Swoole Table and Atomic directly. Verify the constraints against your application's PHP and Hyperf versions.
Is hyperf/memory safe to use across coroutines and worker processes?
Swoole Table is designed to share data across worker processes, and Atomic counters provide lock-free, concurrency-safe increments. The component is described as coroutine-friendly and lightweight, but you must still design your data access carefully around Swoole Table's row-level semantics. It is not a general-purpose database and does not provide transactions.
Can I use hyperf/memory for atomic counters and rate limiting?
Yes, the Atomic manager exposes Swoole Atomic counters for concurrency-safe increments without locks. That makes it suitable for simple counters, statistics, and lightweight rate-limiting patterns inside a Hyperf service. Remember that these counters are in memory and reset when the process or server restarts.
How do I test code that depends on hyperf/memory?
Because the component depends on Swoole Table and Atomic, tests generally need the Swoole extension and a runtime that supports it. Use Hyperf's testing utilities and coroutine-aware test setup, or mock the manager interfaces for unit tests. Integration tests are the best way to verify cross-worker behavior.
What are alternatives to hyperf/memory for shared state?
Common alternatives include Redis or another external cache for durable shared state, APCu for simple local caching, or using Swoole Table directly without the manager wrapper. Hyperf's cache component can also handle shared data when you need persistence or cross-service access. Choose based on whether you need speed and locality or durability and distribution.
Is hyperf/memory production-ready and maintained?
It is part of the Hyperf package ecosystem and is intended for production Hyperf services that already use Swoole. Check the repository's release history and issue tracker for maintenance activity, because the provided context does not include repository details. Since shared memory is ephemeral, plan for process restarts and avoid treating it as persistent storage.
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.
vento/laravel-airbrake
wfeller/laravel-batch
maco-studios/mage-os-installer
busarm/armie
siberfx/laravel-logger
kfteam1991/dcat-admin
dashed/dashed-laposta
dashed/dashed-ecommerce-montaportal
dashed/dashed-ecommerce-etsy
neohq/string-blade-compiler
log1x/acf-composer
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core
nodisrupt/laravel-agent
sierratecnologia/media-manager