Search by

mykiwi / castor-extended

mykiwi

Makefile logic for Castor

Package info

github.com/mykiwi/castor-extended

pkg:composer/mykiwi/castor-extended

Statistics

Installs: 5

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.1 2026-09-15 22:25 UTC

This package is auto-updated.

Last update: 2026-09-15 22:37:44 UTC


README

⚠️ Pet project (for now) made with LLMs 🦾

Reusable helpers for Castor tasks, not (yet) part of Castor core.

Usage

#[Target]/#[Requires]

Makefile-style rebuild logic: turn a plain function into a rebuild recipe with #[Target], then run it before a task's own body — but only if needed — by referencing its name with #[Requires].

use Castor\Attribute\AsTask;
use Mykiwi\CastorExtended\Attribute\{Requires, Target};

use function Castor\run;

#[Target(deps: 'composer.lock', update: true)]
function vendor(): void
{
    run('composer install --no-interaction');
}

#[Target(target: 'public/bundles', deps: ['vendor', 'config/bundles.php'], update: true)]
#[Requires('vendor')]
function assets(): void
{
    run('bin/console assets:install public');
}

#[AsTask(description: 'Start the local dev server')]
#[Requires('assets')]
function serve(): void
{
    run('symfony serve');
}

Full parameter reference and failure/concurrency semantics live in the attributes' own docblocks (linked above). Need a Finder, or a one-off rebuild no task shares? Call make() directly — it's the primitive #[Target] itself is built on.

Installation

As a Castor remote import (recommended for consuming projects)

castor composer init  # creates castor.composer.json, once
castor composer require mykiwi/castor-extended

Commit castor.composer.json and castor.composer.lock. Then add the import to castor.php, once:

use function Castor\import;
use Mykiwi\CastorExtended\Attribute\{Requires, Target};
import('composer://mykiwi/castor-extended');

See examples for a working copy of these three files.

Contributing / local development

A devenv shell (devenv shell) provides PHP 8.5, Composer and Castor with no manual install.

Dev tooling is a plain Makefile, not Castor — root castor.php is the library's own import entrypoint, so it can't also carry dev tasks:

make cs       # apply php-cs-fixer
make test     # run phpunit
make stan     # run phpstan
make ci       # run everything above
make build    # build castor bundled with this library (see nix/build.nix)