slendium/build

Small utility to organize tasks to make a PHP project production ready

Maintainers

Package info

github.com/slendium/build

pkg:composer/slendium/build

Statistics

Installs: 3

Dependents: 0

Suggesters: 0

Stars: 0

v0.2.0 2026-06-28 08:33 UTC

This package is auto-updated.

Last update: 2026-06-28 08:36:57 UTC


README

Small utility for making PHP projects production-ready. Validating code using unit tests or static analysis should happen before this tool runs.

Installation

Simply run composer require slendium/build to add it to your project.

Usage

From your project root, run ./vendor/bin/slendium-build to start the "build" in the current working directory. WARNING: tasks may remove local files, so make sure to only run this command on a clean copy of the project.

The script will go through the following steps:

  1. Run composer install --no-dev --classmap-authoritative
  2. Find a list of tasks to run
    1. Either directly from the arguments, where each argument should be a PHP class-string<Task>
    2. Or from a file called SlendiumBuild.json in the current working directory
  3. Run the tasks in the given order, if all classes exist

SlendiumBuild.json

This JSON file can be put in your project root to specify build options. Currently it supports one key:

  • tasks - a non-empty list of class-string<Task>'s to run in the given order

Tasks

To define your own task, simply create a PHP class that implements the Task interface and add the fully qualified class name to the script arguments or to the JSON configuration file.

Example task

class MyTask implements Task {

	#[Override]
	public function run(BuildEnvironment $environment): iterable {
		$items = \iterator_to_array(ClassmapSearch::byInstanceOf($environment->classmap, Marker::class));

		$progress = 0;
		foreach ($items as $class => file) {
			MyClassAnalysisUtil::analyze($class);

			$progress += 1;
			yield new Task\ProgressUpdate($progress, \count($items));
		}

		if ($progress === 0) {
			yield new Task\Warning("Project did not contain any Marker classes to analyze");
		}
	}

}