Download the PHP package yousefkadah/laravel-memory-profiler without Composer

On this page you can find all versions of the php package yousefkadah/laravel-memory-profiler. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-memory-profiler

Laravel Memory Profiler

A Laravel package that provides memory profiling capabilities for Artisan commands without requiring Xdebug. This package helps developers identify memory leaks and optimize memory usage in their Laravel applications.

Features

Installation

Install the package via Composer:

The package will automatically register its service provider.

Publish the configuration file (optional):

Usage

Basic Usage

Profile any Artisan command by prefixing it with profile:memory:

Advanced Usage

Real-world Examples

Understanding the Reports

HTML Report

The HTML report includes:

JSON Report

The JSON report contains:

Key Metrics

Configuration

The package can be configured via the config/memory-profiler.php file:

Detecting Memory Leaks

Common Signs of Memory Leaks

  1. Positive Memory Difference: Final memory usage is significantly higher than initial
  2. Increasing Memory Trend: Memory usage consistently grows over time
  3. High Peak Memory: Memory usage exceeds reasonable thresholds

Common Causes and Solutions

1. Eloquent Model Accumulation

2. Database Query Log Growth

3. Static Variable Accumulation

Best Practices

  1. Profile Long-running Commands: Focus on commands that run for extended periods
  2. Use Chunking: Process large datasets in smaller chunks
  3. Monitor Database Queries: Watch for N+1 queries and excessive query logging
  4. Clear Static Variables: Reset static caches in long-running processes
  5. Force Garbage Collection: Use gc_collect_cycles() if needed
  6. Set Memory Limits: Use --memory option for queue workers

Troubleshooting

High Memory Usage

If you see high memory usage:

  1. Check the database query count in the report
  2. Look for increasing memory trends
  3. Examine the timing of peak memory usage
  4. Review your code for static variable accumulation

Inaccurate Results

If results seem inaccurate:

  1. Reduce the sampling interval for more precision
  2. Ensure no other processes are affecting memory
  3. Run the profiler multiple times for consistency
  4. Check if garbage collection is affecting measurements

Performance Impact

The profiler has minimal performance impact, but you can:

  1. Increase sampling interval to reduce overhead
  2. Disable database query tracking if not needed
  3. Use JSON format only for faster report generation

Requirements

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This package is open-sourced software licensed under the MIT license.

Support

If you discover any security vulnerabilities or bugs, please send an e-mail to [email protected].

Changelog

v1.0.0


All versions of laravel-memory-profiler with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4|^8.0
illuminate/console Version ^8.0|^9.0|^10.0|^11.0
illuminate/support Version ^8.0|^9.0|^10.0|^11.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package yousefkadah/laravel-memory-profiler contains the following files

Loading the files please wait ....