{"id":29635388,"url":"https://github.com/yohn/project-structure-manager","last_synced_at":"2026-03-10T23:37:27.064Z","repository":{"id":298018168,"uuid":"998568849","full_name":"Yohn/project-structure-manager","owner":"Yohn","description":"Create a STRUCTURE.md file, and build a project with a STRUCTURE.md file.","archived":false,"fork":false,"pushed_at":"2025-06-08T23:55:15.000Z","size":35,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-21T17:06:27.204Z","etag":null,"topics":["directories-utility","directory-structure-generator","directory-tree","php-structures","structure","structure-generator"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Yohn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-08T22:13:02.000Z","updated_at":"2025-06-08T23:52:48.000Z","dependencies_parsed_at":"2025-06-09T00:27:59.532Z","dependency_job_id":"fcd701d3-5c6b-4c70-93c8-833fa3139a87","html_url":"https://github.com/Yohn/project-structure-manager","commit_stats":null,"previous_names":["yohn/project-structure-manager"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/Yohn/project-structure-manager","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yohn%2Fproject-structure-manager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yohn%2Fproject-structure-manager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yohn%2Fproject-structure-manager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yohn%2Fproject-structure-manager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Yohn","download_url":"https://codeload.github.com/Yohn/project-structure-manager/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yohn%2Fproject-structure-manager/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30362123,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T21:41:54.280Z","status":"ssl_error","status_checked_at":"2026-03-10T21:40:59.357Z","response_time":106,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["directories-utility","directory-structure-generator","directory-tree","php-structures","structure","structure-generator"],"created_at":"2025-07-21T16:38:41.079Z","updated_at":"2026-03-10T23:37:27.043Z","avatar_url":"https://github.com/Yohn.png","language":"PHP","readme":"# Project Structure Manager\n\nA powerful PHP 8.3+ composer library for generating and creating project directory structures using Markdown templates.\n\n\u003e The tests are not currently functioning properly. \u003cbr\u003eIf I get time I'll trying to fix them. Pull requests are always welcome!\n\n## Features\n\n- **Generate STRUCTURE.md** - Scan any directory and create a markdown representation of its structure\n- **Create from Templates** - Build project structures from predefined or custom markdown templates\n- **CLI Interface** - Easy-to-use command line interface with tab completion\n- **Template Variables** - Support for dynamic templates with variable substitution\n- **Validation** - Built-in validation for structure files and templates\n- **Dry Run Mode** - Preview what would be created before actually creating it\n- **Extensible** - Object-oriented design following PHP 8.3+ best practices\n\n## Installation\n\n```bash\ncomposer require yohns/project-structure-manager\n```\n\n## CLI Usage\n\n### Generate Structure Command\n\n```bash\n./vendor/bin/project-structure generate [path] [options]\n```\n\n#### Arguments\n- `path` - Directory to scan (default: current directory)\n\n#### Options\n- `--output`, `-o` - Output file path (default: `STRUCTURE.md`)\n- `--exclude`, `-e` - Patterns to exclude (can be used multiple times)\n- `--max-depth`, `-d` - Maximum directory depth (default: `10`)\n- `--show-preview`, `-p` - Show preview before saving\n\n#### Examples\n```bash\n# Basic generation\n./vendor/bin/project-structure generate\n\n# Custom output location\n./vendor/bin/project-structure generate --output=docs/structure.md\n\n# Exclude patterns\n./vendor/bin/project-structure generate \\\n  --exclude=vendor \\\n  --exclude=node_modules \\\n  --exclude=.git \\\n  --exclude=\"*.log\"\n\n# Limit depth and preview\n./vendor/bin/project-structure generate \\\n  --max-depth=5 \\\n  --show-preview\n\n# Scan specific directory\n./vendor/bin/project-structure generate /path/to/project \\\n  --output=/docs/project-structure.md\n```\n\n### Create Structure Command\n\n```bash\n./vendor/bin/project-structure create \u003cstructure-file\u003e [options]\n```\n\n#### Arguments\n- `structure-file` - Path to STRUCTURE.md file or template name\n\n#### Options\n- `--target`, `-t` - Target directory (default: current directory)\n- `--template` - Treat input as template name\n- `--variables`, `-v` - Template variables (key=value, can be used multiple times)\n- `--dry-run` - Preview without creating\n- `--force`, `-f` - Force creation/overwrite\n- `--validate-only` - Only validate structure\n\n#### Examples\n```bash\n# Create from file\n./vendor/bin/project-structure create structure.md\n\n# Target specific directory\n./vendor/bin/project-structure create structure.md --target=new-project\n\n# Dry run preview\n./vendor/bin/project-structure create structure.md --dry-run\n\n# Use template with variables\n./vendor/bin/project-structure create php-library --template \\\n  --variables PROJECT_NAME=MyLibrary \\\n  --variables AUTHOR=\"John Doe\" \\\n  --variables NAMESPACE=MyLib\n\n# Validate only\n./vendor/bin/project-structure create structure.md --validate-only\n\n# Force creation\n./vendor/bin/project-structure create structure.md \\\n  --target=existing-dir \\\n  --force\n```\n\n## PHP API Usage\n\n### StructureGenerator\n\n#### Constructor Options\n```php\nuse Yohns\\ProjectStructure\\Service\\StructureGenerator;\n\n// Scan current directory\n$generator = new StructureGenerator();\n\n// Scan specific directory\n$generator = new StructureGenerator('/path/to/scan');\n```\n\n#### Configuration Methods\n```php\n// Set exclude patterns\n$generator-\u003esetExcludePatterns([\n    'vendor',\n    'node_modules',\n    '.git',\n    '.DS_Store',\n    '*.tmp',\n    '*.log',\n    'cache/*',\n    'temp*'\n]);\n```\n\n#### Generation Methods\n```php\n// Generate structure (path, maxDepth)\n$structure = $generator-\u003egenerateStructure('', 10);\n\n// Generate markdown\n$markdown = $generator-\u003egenerateMarkdown($structure);\n\n// Save to file\n$generator-\u003esaveToFile($markdown, 'custom-structure.md');\n$generator-\u003esaveToFile($markdown, '/full/path/structure.md');\n```\n\n#### Complete Example\n```php\n$generator = new StructureGenerator('/my/project');\n$generator-\u003esetExcludePatterns(['vendor', 'node_modules', '.git']);\n\n$structure = $generator-\u003egenerateStructure('', 8);\n$markdown = $generator-\u003egenerateMarkdown($structure);\n$generator-\u003esaveToFile($markdown, 'docs/project-structure.md');\n```\n\n### StructureCreator\n\n#### Constructor Options\n```php\nuse Yohns\\ProjectStructure\\Service\\StructureCreator;\n\n// Create in current directory\n$creator = new StructureCreator();\n\n// Create in specific directory\n$creator = new StructureCreator('/target/path');\n```\n\n#### Creation Methods\n```php\n// From markdown file\n$result = $creator-\u003ecreateFromMarkdownFile('structure.md', $dryRun = false);\n\n// From markdown content\n$content = file_get_contents('structure.md');\n$result = $creator-\u003ecreateFromMarkdownContent($content, $dryRun = false);\n\n// From template\n$variables = ['PROJECT_NAME' =\u003e 'MyApp', 'AUTHOR' =\u003e 'John Doe'];\n$result = $creator-\u003ecreateFromTemplate('php-library', $variables, $dryRun = false);\n```\n\n#### Validation\n```php\n// Validate structure\n$errors = $creator-\u003evalidateStructure($content);\nif (empty($errors)) {\n    $result = $creator-\u003ecreateFromMarkdownContent($content);\n} else {\n    foreach ($errors as $error) {\n        echo \"Error: {$error}\\n\";\n    }\n}\n```\n\n#### Complete Example\n```php\n$creator = new StructureCreator('/new/project');\n\n// Validate first\n$content = file_get_contents('my-structure.md');\n$errors = $creator-\u003evalidateStructure($content);\n\nif (empty($errors)) {\n    // Dry run preview\n    $preview = $creator-\u003ecreateFromMarkdownContent($content, true);\n    echo \"Would create \" . count($preview['files']) . \" files\\n\";\n\n    // Create for real\n    $result = $creator-\u003ecreateFromMarkdownContent($content, false);\n    echo \"Created \" . count($result['files']) . \" files\\n\";\n}\n```\n\n## Configuration Options Reference\n\n### Exclude Patterns\n```php\n// Default patterns\n$defaultExcludes = [\n    'vendor',       // Composer dependencies\n    'node_modules', // NPM dependencies\n    '.git',         // Git repository\n    '.DS_Store',    // macOS system files\n    '*.tmp',        // Temporary files\n    '*.log'         // Log files\n];\n\n// Pattern types\n$patterns = [\n    'exact-name',           // Exact directory/file name\n    '*.extension',          // File extension wildcard\n    'prefix*',              // Prefix wildcard\n    '*suffix',              // Suffix wildcard\n    'dir/*',                // Directory contents\n    '.hidden',              // Hidden files/directories\n];\n```\n\n### Template Variables\n```php\n// Simple substitution\n$variables = [\n    'PROJECT_NAME' =\u003e 'MyProject',\n    'AUTHOR' =\u003e 'John Doe',\n    'NAMESPACE' =\u003e 'MyProject\\\\Core',\n    'MAIN_CLASS' =\u003e 'Application'\n];\n\n// Conditional variables\n$variables = [\n    'DOCS' =\u003e true,         // {{if DOCS}}content{{/if}}\n    'LICENSE' =\u003e 'MIT',     // {{if LICENSE}}content{{/if}}\n    'TESTING' =\u003e false      // Empty = false condition\n];\n```\n\n### File Content Templates\nDefault content by extension:\n- `.php` - PHP declaration header\n- `.js` - 'use strict' directive\n- `.html` - Basic HTML structure\n- `.json` - Empty JSON object `{}`\n- `.md` - Basic markdown structure\n- `.yml/.yaml` - YAML comment header\n- `.css` - CSS comment header\n\n### Validation Rules\n- Path length limits\n- Invalid characters check\n- Reserved filename detection\n- Duplicate path prevention\n- Directory depth limits\n- File permission validation\n\n## Built-in Templates\n\n### php-library\nStandard PHP library structure with PSR-4 autoloading.\n\n**Variables:**\n- `PROJECT_NAME` (required)\n- `NAMESPACE` (optional)\n- `MAIN_CLASS` (optional)\n- `AUTHOR` (optional)\n- `DESCRIPTION` (optional)\n\n### web-app\nBasic web application with MVC structure.\n\n**Variables:**\n- `PROJECT_NAME` (required)\n- `FRAMEWORK` (optional)\n- `DATABASE` (optional)\n\n## Error Handling\n\nThe library provides specific exception types:\n\n- `StructureCreationException` - File/directory creation errors\n- `ParseException` - Markdown parsing errors\n- `ValidationException` - Structure validation errors\n- `TemplateException` - Template processing errors\n- `FilesystemException` - File system access errors\n\n## Requirements\n\n- PHP 8.3+\n- Composer\n- Extensions: json, mbstring\n\n## Dependencies\n\n- **symfony/console** - CLI framework\n- **league/flysystem** - Filesystem abstraction\n- **league/commonmark** - Markdown processing\n- **symfony/filesystem** - File operations\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch\n3. Make your changes following PSR-12 standards\n4. Add tests for new functionality\n5. Submit a pull request\n\n## License\n\nMIT License - see LICENSE file for details.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyohn%2Fproject-structure-manager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyohn%2Fproject-structure-manager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyohn%2Fproject-structure-manager/lists"}