Download the PHP package robertogallea/laravel-necromancer without Composer

On this page you can find all versions of the php package robertogallea/laravel-necromancer. 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-necromancer

Laravel Necromancer

Laravel Necromancer scans your bootstrapped Laravel application and builds a structured, machine-readable inventory called the manifest. From that manifest you can display a terminal map of your application, run an AI-readability audit, and generate a Markdown context file that AI coding agents can load as ambient context — so they always have an accurate picture of your routes, models, jobs, events, observers, scheduled tasks, middleware, Livewire components, gates, mailables, validation rules, service providers, and more.

What Necromancer Collects

The manifest covers 18 artifact types across the full Laravel application structure:

Type What it surfaces
routes Name, method, URI, controller, action, middleware, authorization
models Table, fillable, casts, appends, relationships, scopes, observers, policy, factory
jobs Queue, connection, tries, timeout, backoff, max_exceptions
events Listeners, broadcastable channels
listeners Handled events, queued status
commands Signature, description, aliases
form_requests Rules, stop_on_first_failure, error_bag
policies Model, policy methods
enums Backing type, cases
tests File, type (unit/feature), subject class, test methods
observers Model, lifecycle hooks, queued status
scheduled_tasks Command, cron expression, human-readable schedule, flags
middleware Alias, class, scope (global/group/alias), group name
livewire_components View, public properties with types, action methods, listened events
gates Ability, kind (closure/class/before_hook/after_hook), parameters
mailables Subject, queued status, queue name, view/markdown template
validation_rules Implicit flag, docblock description
service_providers Deferred flag, source location

All artifact types carry a source field with file, line, line_end, and hash for precise citations and stale detection.

Requirements

Version
PHP ≥ 8.3
Laravel 13.x

Installation

Install the package as a development dependency:

The service provider is auto-discovered — no manual registration is needed.

Optionally publish the configuration file:

Usage

Necromancer follows a scan-first workflow. Every other command reads the manifest produced by necromancer:scan rather than re-scanning the application.

Step 1 — Scan

Inspects the running application and writes necromancer.json to the project root. Re-run this command whenever your application changes. Collect only specific artifact types with --only:

Necromancer reads PHP attributes (#[ObservedBy], #[Queue], #[Aliases], #[Authorize], etc.) as primary sources alongside class properties. Codebases using the attribute-based API introduced in Laravel 11+ are fully supported — jobs configured via #[Queue]/#[Tries]/#[Timeout], models with #[ObservedBy]/#[ScopedBy], and commands with #[Aliases] all appear correctly in the manifest.

Test files in tests/Unit/ and tests/Feature/ are scanned and included as a tests artifact type. Both Pest functional-style files (test()/it() calls) and class-based PHPUnit tests are supported. Subject classes are inferred from uses() declarations and filename convention (OrderTest.phpApp\Models\Order).

Check for manifest drift without writing a new file (CI use):

Step 2 — Explore (optional)

Display the full application inventory in the terminal:

Narrow the output to a single artifact type:

Step 3a — Audit AI readability

Check how well your application can be understood by an AI coding agent:

Each finding is grouped by severity (error / warning / suggestion). The score is a weighted pass-rate across all checks — normalized by the number of applicable artifacts — so an app with 1 unnamed route out of 50 scores far better than one with 1 out of 1. Errors weigh 3×, warnings 2×, and suggestions 1× in the calculation. Output a shareable or machine-readable report, or enforce a CI gate:

Step 3b — Check the AI readability score

Get a quick percentage score across seven weighted dimensions of AI readability:

Each dimension shows a progress bar, a percentage, and a detail line:

Output a machine-readable score or enforce a CI gate:

Step 3c — Generate AI context

Write a Markdown context file your AI tool can load:

Produces NECROMANCER.md at the project root. The generated file includes a ## Tests table when test artifacts are present:

Generate only specific sections:

Supported types: routes, models, form_requests, jobs, events, listeners, commands, policies, enums, tests, observers, scheduled_tasks, middleware, livewire_components, gates, mailables, validation_rules, service_providers.

Exclude specific sections instead of listing everything you want:

--only and --except are mutually exclusive.

Filter by source path to generate context for just one slice of the application:

--paths matches each artifact's source.file by path prefix (after normalizing slashes) and is applied on top of --only/--except, so it can be combined with either. Paths are case-sensitive on Linux and case-insensitive on macOS/Windows, following the filesystem. Artifacts without a source file (closure routes, inline gates) are excluded while --paths is active, sections that end up empty are omitted, and a path that matches nothing emits a warning without failing.

Skip the overwrite confirmation when regenerating:

Write to a custom path:

Step 3d — Ask a question about your codebase

Ask a natural-language question and get a grounded answer from your manifest:

If you omit the question, the command prompts you interactively. The manifest is injected verbatim into the AI's context, so answers are grounded in your actual application — not a model's prior knowledge. A warning is shown if the manifest may be stale.

Requires laravel/ai installed and an AI provider configured in config/ai.php.

Inspect the AI payload

Before committing to a provider, check exactly what Necromancer sends to the AI and how large the payload is:

Prints the full manifest JSON, the estimated token count, and a breakdown of artifact type counts. Pass --privacy to see the condensed privacy-safe summary instead (the payload used when a privacy-conscious provider is configured):


Step 3e — Infer Architecture Decision Records

Generate Architecture Decision Records from the manifest using an AI provider:

Requires laravel/ai installed and an AI provider configured in config/ai.php.

Options

Option Description
--locale=it Translate ADRs into additional locales (comma-separated, e.g. --locale=it,fr). The default app locale is always inferred first; extra locales are translated from it.
--temperature=0 LLM temperature (0.0–2.0). Lower values produce more deterministic output. Omit to use the provider default.
--max-critic-rounds=N Maximum number of critic review rounds (default 1). The loop exits early if the critic is satisfied before reaching N.
--dry-run Print ADRs to the terminal without writing files.
--force Overwrite existing ADR files without confirmation.
--fresh Delete all existing ADR files and the inference cache, then re-infer from scratch.
--refresh Bypass the cache and re-infer even if the manifest has not changed.

Output

ADRs are written to docs/adr/necromancer/ (canonical locale, flat) and docs/adr/necromancer/{locale}/ for each translated locale. Each file follows the Nygard ADR format:

Decision Taxonomy

The inference agent evaluates nine architectural dimensions and produces at most one ADR per dimension:

Dimension What it covers
async-processing Jobs, queues, workers, retry strategy
authorization Policies, gates, middleware auth guards
event-driven Events, listeners, broadcasting
api-design Route structure, API resources, versioning
data-modeling Model relationships, casts, soft deletes
command-scheduling Artisan commands, scheduled tasks
form-validation Form requests vs inline validation
external-services Mail, storage, payment, third-party services
architecture-pattern Service layer, repository, MVC deviations

Critic Agent

By default, a second AI pass reviews and filters the initial ADRs, removing generic observations and improving specificity. Configure via config/necromancer.php:

Use --max-critic-rounds=N to run up to N review passes. The critic signals when it is satisfied; the loop exits early even if N has not been reached. Each unsatisfied round adds one AI call.

Caching

The command caches inference results in docs/adr/necromancer/.adr-inference-cache.json. The cache key is derived from meta.content_hash (a SHA-256 of the artifact payload written into every manifest by necromancer:scan), plus the temperature and critic settings. Because the hash covers only artifact data — not the scan timestamp — the cache survives re-scans that find no structural changes. On subsequent runs:

Multi-Locale Workflow


Step 3f — Generate a source-grounded prompt

Build a ready-to-paste AI prompt grounded in the most relevant manifest entries for your question:

Necromancer keyword-searches the manifest, ranks artifacts by relevance, and outputs a formatted prompt block with file:line citations that you can paste into any AI tool (Claude, ChatGPT, Cursor, etc.).

If laravel/ai is installed, the question is automatically reformulated into a precise, application-aware version before being included in the prompt. Pass --no-ai to use the raw question instead.

AI reformulation requires laravel/ai installed and configured. The command works without it — only the question contextualization step is skipped.


Step 3g — Compare manifests across branches

Review the architectural changes introduced by a branch compared to another:

Compares the current manifest against the manifest on the main branch. The output shows added, removed, and modified routes, models, jobs, events, listeners, policies, and other artifacts.

Options

Option Description
--base-manifest=PATH Use a specific manifest file instead of comparing branches. Useful for comparing against a snapshot.
--review Enable AI-powered analysis of the changes (requires laravel/ai). Produces a narrative summary of the architectural impact, detected risks, and suggested reviewer questions.
--format=markdown Output in Markdown format (suitable for pasting into PRs or issues).
--output=PATH Write the report to a file instead of printing to the terminal.

Example: Basic diff

Output:

Example: AI-powered review

Output (when laravel/ai is installed):

Note: The --review option requires laravel/ai to be installed and configured. Without it, only the basic diff is shown. Both branches must have a committed necromancer.json manifest.


Step 3h — Benchmark AI context effectiveness

Measure how much Necromancer's generated context file improves AI coding-assistant accuracy, hallucination rate, and token cost compared to a hand-written AGENTS.md or no context at all:

The command runs a bundled task suite in three conditions — no context, manual AGENTS.md, and Necromancer-generated NECROMANCER.md — and reports the results side by side. An optional cross-model AI judge scores quality; automated fact-checks always run.

Q&A tasks (which measure context coverage) only run under the none and manual conditions — Necromancer would trivially score 100% since the answers are in the context file it generated. Code generation and mini tasks run across all three conditions and measure actual effectiveness.

See BENCHMARK.md for full setup instructions, config reference, and bias mitigations.


Commands Reference

Command Purpose Key options
necromancer:scan Build the application manifest --output=PATH, --diff, --fail-on-drift
necromancer:map Display the manifest in the terminal --type=TYPE
necromancer:audit Run the AI-readability audit (violation list) --format=text\|json\|markdown, --output=PATH, --fail-on=SEVERITY
necromancer:doctor Show the AI readability score (percentage dashboard) --json, --min-score=N, --only=KEYS
necromancer:generate Generate the Markdown context file --only=TYPE,TYPE, --except=TYPE,TYPE (18 types: routes, models, jobs, events, listeners, commands, form_requests, policies, enums, tests, observers, scheduled_tasks, middleware, livewire_components, gates, mailables, validation_rules, service_providers), --paths=PATH,PATH, --output=PATH, --force
necromancer:ask Ask a question about your codebase via AI --provider=, --model=
necromancer:inspect-payload Show the AI payload size and content for necromancer:ask --privacy
necromancer:prompt Generate a source-grounded prompt for any AI tool --top=N, --no-ai, --output=PATH
necromancer:infer Generate ADRs via AI --locale=, --temperature=, --fresh, --refresh
necromancer:diff Compare manifests across branches --base-manifest=PATH, --review, --format=markdown, --output=PATH
necromancer:benchmark Benchmark AI context effectiveness (accuracy, hallucination rate, token cost) --condition=, --type=, --no-judge, --model=, --judge=, --format=, --output=PATH

Configuration

After publishing the config, edit config/necromancer.php:

Privacy & Exclusions

Necromancer is designed to be safe to version by default:

To exclude additional routes or models, add patterns to the exclude key in config/necromancer.php. The exclude.routes patterns match against the route name (and therefore never match unnamed routes); use exclude.route_uris to exclude routes by URI — including unnamed ones such as health checks. Both use Str::is() wildcard matching, and route URIs are matched without a leading slash (e.g. up, orders/*). Exclusions apply to every downstream command — map, audit, doctor, and generate — so excluded artifacts never appear in results.

Laravel Boost Integration

When Laravel Boost is installed, necromancer:generate automatically writes the context file to .ai/guidelines/necromancer.md (configurable via boost.context_path) instead of NECROMANCER.md. Boost remains responsible for composing the final agent context; Necromancer only contributes its section.

An explicit --output=PATH flag always takes precedence over the Boost path.

MCP Tools

When Laravel MCP is installed, Necromancer automatically exposes the manifest as read-only MCP tools via a laravel-necromancer server handle:

Tool Description
query_routes List routes, optionally filtered by method or name/URI pattern
query_models List Eloquent models, optionally filtered by class name
query_artifacts List artifacts of any current type, optionally filtered by JSON substring
search_artifacts Full-text search across all artifact types

Use query_artifacts when you already know the artifact type (routes, models, form_requests, jobs, events, listeners, commands, observers, policies, enums, tests, scheduled_tasks, middleware, livewire_components, gates, mailables, validation_rules, or service_providers). Use search_artifacts when you need to search across types.

When laravel/mcp is present, Necromancer also writes its entry into .mcp.json automatically on the first php artisan run after installation — no manual configuration needed. If .mcp.json already exists, the entry is merged without touching other servers.

AI agents connected via Claude Code, Cursor, or any MCP client can then call these tools directly rather than reading necromancer.json by hand.

Requires laravel/mcp installed. Run php artisan necromancer:scan to ensure the manifest is current before connecting an agent.

CI Integration

Add these steps to your CI pipeline to enforce manifest freshness and AI-readability quality:

Contributing

Bug reports and pull requests are welcome on the GitHub repository.

License

MIT


All versions of laravel-necromancer with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
illuminate/support Version ^13.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 robertogallea/laravel-necromancer contains the following files

Loading the files please wait ...