xul/laravel-project-map

Laravel package for generating project structure maps

Maintainers

Package info

github.com/Xultech-LTD/laravel-project-map

pkg:composer/xul/laravel-project-map

Statistics

Installs: 4

Dependents: 0

Suggesters: 0

Stars: 2

Open Issues: 0

v1.0.0 2026-03-24 11:28 UTC

This package is auto-updated.

Last update: 2026-04-24 11:46:52 UTC


README

Generate clean, configurable maps of your Laravel project structure.

Tests Latest Version PHP Version Laravel Versions License

๐Ÿ“Œ Overview

Laravel Project Map is a developer-focused tool for generating a structured view of your application's filesystem.

It helps you:

  • visualize your project structure
  • audit large codebases
  • inspect architecture quickly
  • generate shareable project maps (text or JSON)

โšก Features

  • Artisan command: project:map
  • Recursive directory mapping
  • Configurable depth
  • Include/exclude files
  • Hidden file support
  • Vendor & node_modules toggles
  • JSON and text output formats
  • Save output to file
  • Fully tested (Pest)

๐Ÿ“ฆ Installation

composer require xul/laravel-project-map

โš™๏ธ Publish Configuration (Optional)

php artisan vendor:publish --tag=project-map-config

๐Ÿš€ Usage

Basic

php artisan project:map

Include files

php artisan project:map --files

Limit depth

php artisan project:map --depth=2

Include vendor and node_modules

php artisan project:map --vendor --node-modules

Include hidden files

php artisan project:map --hidden

Output as JSON

php artisan project:map --format=json

Save output to file

php artisan project:map --save=project-map.txt

Combine options

php artisan project:map --files --depth=3 --vendor --format=json --save=map.json

๐Ÿงพ Example Output

Text Output

project-root/
โ”œโ”€โ”€ app/
โ”‚   โ”œโ”€โ”€ Http/
โ”‚   โ””โ”€โ”€ Models/
โ”œโ”€โ”€ routes/
โ”‚   โ””โ”€โ”€ web.php
โ””โ”€โ”€ config/

JSON Output

[
    {
        "name": "app",
        "type": "directory",
        "path": "/project/app",
        "children": [...]
    }
]

โš™๏ธ Configuration

<?php

declare(strict_types=1);

return [

    /*
    |--------------------------------------------------------------------------
    | Default Scan Path
    |--------------------------------------------------------------------------
    |
    | This is the default base path that will be scanned when no explicit
    | path is provided to the Artisan command.
    |
    | In most Laravel projects, this should remain as base_path().
    |
    */

    'default_path' => base_path(),

    /*
    |--------------------------------------------------------------------------
    | Default Maximum Depth
    |--------------------------------------------------------------------------
    |
    | This value determines how many directory levels should be traversed
    | when generating the project map.
    |
    | Example:
    | - 1 = root level only
    | - 2 = root + one nested level
    | - 5 = deeper project inspection
    |
    */

    'default_depth' => 5,

    /*
    |--------------------------------------------------------------------------
    | Include Files
    |--------------------------------------------------------------------------
    |
    | Determines whether files should be included in the generated output.
    |
    | When set to false, only directories will be listed.
    | When set to true, both directories and files will be included.
    |
    */

    'include_files' => false,

    /*
    |--------------------------------------------------------------------------
    | Hidden Files and Directories
    |--------------------------------------------------------------------------
    |
    | Determines whether hidden files and directories should be included
    | in the generated output.
    |
    | This affects dot-prefixed paths such as:
    | - .git
    | - .idea
    | - .vscode
    | - .env.example
    |
    */

    'include_hidden' => false,

    /*
    |--------------------------------------------------------------------------
    | Excluded Paths
    |--------------------------------------------------------------------------
    |
    | These paths will be excluded from the generated project map by default.
    |
    | The values may be relative to the project base path. Common heavy or
    | generated directories are excluded to keep the output clean and fast.
    |
    */

    'exclude' => [
        'vendor',
        'node_modules',
        '.git',
        'storage/logs',
        'bootstrap/cache',
    ],

    /*
    |--------------------------------------------------------------------------
    | Optional Directory Toggles
    |--------------------------------------------------------------------------
    |
    | These toggles provide a more expressive way for users to control whether
    | commonly excluded heavy directories should be scanned.
    |
    | If enabled, the related path may be removed from exclusion internally
    | before the scan begins.
    |
    */

    'include_vendor' => false,

    'include_node_modules' => false,

    /*
    |--------------------------------------------------------------------------
    | Exclude By Name
    |--------------------------------------------------------------------------
    |
    | These directory or file names will be excluded anywhere they appear
    | in the scanned structure.
    |
    | This is useful for filtering common generated artifacts globally
    | without specifying full paths.
    |
    */

    'exclude_names' => [
        '.DS_Store',
        'Thumbs.db',
    ],

    /*
    |--------------------------------------------------------------------------
    | Sort Directories First
    |--------------------------------------------------------------------------
    |
    | When enabled, directories will be listed before files.
    | This usually makes the generated structure easier to read.
    |
    */

    'sort_directories_first' => true,

    /*
    |--------------------------------------------------------------------------
    | Case Sensitive Sorting
    |--------------------------------------------------------------------------
    |
    | Determines whether names should be sorted with case sensitivity.
    | In most cases, false produces more user-friendly output.
    |
    */

    'case_sensitive_sort' => false,

    /*
    |--------------------------------------------------------------------------
    | Follow Symbolic Links
    |--------------------------------------------------------------------------
    |
    | Determines whether symbolic links should be followed during traversal.
    |
    | This is disabled by default to avoid unexpected recursion or scanning
    | outside the intended project boundary.
    |
    */

    'follow_symlinks' => false,

    /*
    |--------------------------------------------------------------------------
    | Output Format
    |--------------------------------------------------------------------------
    |
    | Defines the default output format when no format option is supplied.
    |
    | Supported values:
    | - text
    | - json
    |
    */

    'output' => [
        'default_format' => 'text',

        /*
        |--------------------------------------------------------------------------
        | Save Path
        |--------------------------------------------------------------------------
        |
        | Optional default save location for generated project maps.
        | Leave as null to print only to the console unless --save is used.
        |
        */

        'default_save_path' => null,
    ],
];

๐Ÿงช Testing

vendor/bin/pest

๐Ÿค Contributing

Please review CONTRIBUTING.md before submitting changes.

๐Ÿ”’ Security

If you discover any security issues, please review SECURITY.md.

๐Ÿ”„ Upgrade Guide

See UPGRADE.md for upgrade instructions.

๐Ÿ“œ License

The MIT License (MIT). See LICENSE.md for details.

๐Ÿ‘ค Author

Michael Erastus
GitHub: https://github.com/michaelerastus

โญ Support

If you find this package useful, consider giving it a star on GitHub.