Download the PHP package kytoonlabs/composer-cleanup without Composer

On this page you can find all versions of the php package kytoonlabs/composer-cleanup. 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 composer-cleanup

Composer Cleanup

A Composer plugin that analyzes Laravel applications and removes unused dependencies from the vendor folder. This package provides a manual command to keep your vendor directory clean and reduce deployment size.

Features

Installation

Via Composer (Recommended)

  1. Install the package:

  2. Create a configuration file:

  3. Customize the configuration file as needed

Manual Installation

  1. Clone this repository:

  2. Install dependencies:

  3. Run the installation script:

Usage

As Composer Script

Run the cleanup command:

Manual Execution

If installed manually, you can run:

This will:

  1. Analyze your Laravel application for used classes and namespaces
  2. Identify unused vendor packages
  3. Remove the unused packages (unless in dry-run mode)
  4. Regenerate autoload files

Configuration

Create a composer-cleanup.json file in your project root to customize the behavior:

Configuration Options

How It Works

  1. File Scanning: The plugin scans all PHP files in your Laravel application directories
  2. AST Analysis: Uses PHP Parser to create an Abstract Syntax Tree and extract:
    • use statements (imported namespaces)
    • new expressions (instantiated classes)
    • Static method calls and property access
    • Class constant access
    • Type hints in function parameters and return types
    • Class inheritance (extends/implements)
    • Trait usage
    • Instanceof checks
    • Catch block exception types
  3. Package Analysis: Examines each installed package's autoload configuration
  4. Usage Detection: Determines if a package's classes are actually used in your code
  5. Cleanup: Removes packages that are not referenced in your application

Safety Features

Example Output

Development

Running Tests

Building

Project Structure

Requirements

Dependencies

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Submit a pull request

License

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

Disclaimer

This tool analyzes static code and may not detect all dynamic usage patterns. Always test your application thoroughly after running the cleanup, especially in production environments. Consider using dry-run mode first to review what would be removed.

Important: The tool runs in dry-run mode by default for safety. Set "dry_run": false in your configuration to actually remove packages.


All versions of composer-cleanup with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
nikic/php-parser Version ^5.0
symfony/finder Version ^7.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 kytoonlabs/composer-cleanup contains the following files

Loading the files please wait ....