{"id":21549024,"url":"https://github.com/nuvoleweb/drupal-component-scaffold","last_synced_at":"2025-08-01T05:09:52.528Z","repository":{"id":57029406,"uuid":"103783192","full_name":"nuvoleweb/drupal-component-scaffold","owner":"nuvoleweb","description":"Scaffolding Composer plugin for Drupal modules and themes.","archived":false,"fork":false,"pushed_at":"2017-12-01T11:07:59.000Z","size":33,"stargazers_count":12,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-10T06:04:25.193Z","etag":null,"topics":["composer-plugin","drupal","drupal-8"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nuvoleweb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-16T20:54:26.000Z","updated_at":"2024-09-02T10:02:32.000Z","dependencies_parsed_at":"2022-08-23T17:40:50.201Z","dependency_job_id":null,"html_url":"https://github.com/nuvoleweb/drupal-component-scaffold","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/nuvoleweb/drupal-component-scaffold","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuvoleweb%2Fdrupal-component-scaffold","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuvoleweb%2Fdrupal-component-scaffold/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuvoleweb%2Fdrupal-component-scaffold/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuvoleweb%2Fdrupal-component-scaffold/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nuvoleweb","download_url":"https://codeload.github.com/nuvoleweb/drupal-component-scaffold/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuvoleweb%2Fdrupal-component-scaffold/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268171959,"owners_count":24207437,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-01T02:00:08.611Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["composer-plugin","drupal","drupal-8"],"created_at":"2024-11-24T06:20:40.202Z","updated_at":"2025-08-01T05:09:52.488Z","avatar_url":"https://github.com/nuvoleweb.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Drupal Component Scaffold\n\n[![Build Status](https://travis-ci.org/nuvoleweb/drupal-component-scaffold.svg?branch=master)](https://travis-ci.org/nuvoleweb/drupal-component-scaffold)\n\n*Drupal Component Scaffold* is a [Composer plugin](https://getcomposer.org/doc/articles/plugins.md) that helps Drupal 8\nproject maintainers enjoy leaner development workflow: working on modules and themes will be like working on any other\nmodern PHP component.\n\nOnce installed the plugin allows to:\n\n- Specify all project's development dependencies in `require-dev`, like Drupal core, modules, themes or any needed\n  testing libraries (PHPUnit, PHPSpec, Behat, etc.). [See an example here](https://github.com/nuvoleweb/ui_patterns/blob/8.x-1.x/composer.json).\n- Build a fully functional Drupal site right within the project directory by bundling all listed dependencies by just\n  running `composer install`.\n- Have the same setup on both local development and continuous integration pipelines. This also leads to\n  [cleaner CI configuration files](https://github.com/nuvoleweb/ui_patterns/blob/8.x-1.x/.travis.yml).\n\nThe plugin leverages the excellent [Drupal Scaffold](https://github.com/drupal-composer/drupal-scaffold) project and\nfires only after (and if) its main scaffolding tasks are ran.\n\n## Usage\n\nRequire it via Composer as follow:\n\n```\n$ composer require nuvoleweb/drupal-component-scaffold --dev\n```\n\nList all your dependencies (core version, modules, etc.) and run:\n\n```\n$ composer update\n```\n\nFor example, take the following `composer.json`:\n\n```json\n{\n  \"name\": \"drupal/my_module\",\n  \"type\": \"drupal-module\",\n  \"require\": {\n    \"drupal/ds\": \"~3\"\n  },\n  \"require-dev\": {\n    \"nuvoleweb/drupal-component-scaffold\": \"*\",\n    \"drush/drush\": \"~8.0\",\n    \"drupal/core\": \"~8\",\n    \"drupal/panels\": \"~4\",\n  },\n  \"repositories\": [\n    {\n      \"type\": \"composer\",\n      \"url\": \"https://packages.drupal.org/8\"\n    }\n  ],\n  \"extra\": {\n    \"installer-paths\": {\n      \"web/core\": [\"type:drupal-core\"],\n      \"web/modules/contrib/{$name}\": [\"type:drupal-module\"]\n    }\n  }  \n}\n```\n\nRunning `composer install` will result in:\n\n```\n.\n├── web\n│   ├── autoload.php\n│   ├── core\n│   ├── modules\n│   │   ├── contrib\n│   │   │    └── panels\n│   │   └── custom\n│   │       └── my_module (symlink to project root)\n│   └── sites\n│       ├── default\n│       │   ├── default.services.yml\n│       │   ├── default.settings.php\n│       │   ├── drushrc.php\n│       │   └── settings.local.php\n│       ├── development.services.yml\n│       ├── example.settings.local.php\n│       └── example.sites.php\n├── vendor\n├── composer.json\n├── composer.lock\n├── my_module.info.yml\n└── my_module.module\n```\n\n## Configuration\n\nBuild directory will be derived by the `installer-paths`, make sure you specify there where you wish to install\nyour core, modules etc:\n\n```json\n{\n  \"extra\": {\n    \"installer-paths\": {\n      \"web/core\": [\"type:drupal-core\"],\n      \"web/modules/contrib/{$name}\": [\"type:drupal-module\"]\n    }\n  }\n}\n```\n\nAlso, all options for [Drupal Scaffold](https://github.com/drupal-composer/drupal-scaffold) still apply, check the\nproject's documentation for more.\n\nComponent scaffolding can be triggered at any time by running:\n\n```\n$ composer drupal-component-scaffold\n```\n\n## Setup PHPUnit tests\n\nTo setup [PHPUnit](https://phpunit.de) use the following `phpunit.xml.dist` template:\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003cphpunit bootstrap=\"vendor/autoload.php\" backupGlobals=\"true\" colors=\"true\" \u003e\n  \u003cphp\u003e\n    \u003cini name=\"error_reporting\" value=\"32767\"/\u003e\n    \u003cvar name=\"namespaces\" value=\"\"/\u003e\n    \u003cini name=\"memory_limit\" value=\"-1\"/\u003e\n    \u003cenv name=\"SIMPLETEST_DB\" value=\"mysql://user:pass@host/database\"/\u003e\n  \u003c/php\u003e\n  \u003ctestsuites\u003e\n    \u003ctestsuite\u003e\n      \u003cdirectory\u003e./tests/\u003c/directory\u003e\n    \u003c/testsuite\u003e\n  \u003c/testsuites\u003e\n\u003c/phpunit\u003e\n```\n\nThis will ensure that both [Unit and Kernel](https://www.drupal.org/docs/8/testing/types-of-tests-in-drupal-8) tests\ntests will ran correctly. [See an example here](https://github.com/nuvoleweb/ui_patterns/blob/8.x-1.x/phpunit.xml.dist).\n\n## Inner workings\n\nWhen fired the plugin will:\n\n- Setup [Composer Installers](https://github.com/composer/installers) paths.\n- Register a post-[Drupal Scaffold](https://github.com/drupal-composer/drupal-scaffold) event handler.\n\nAfter Drupal Scaffold is done the plugin will:\n\n - Prepare a custom projects directory at `./web/modules/custom`.\n - Make `./web/sites/default` writable.\n - Symlink your project at `./web/modules/custom/my_module` (or at `./web/themes/custom/my_theme`).\n - Setup default Drush configuration file at `./web/sites/default/drushrc.php`.\n - Make sure that Twig cache is disabled on `./web/sites/development.services.yml`.\n - Setup local development settings at `./web/sites/default/settings.local.php`.\n - Patch Drupal core with [kernel-test-base.patch](dist/kernel-test-base.patch) allowing Kernel tests to run smoothly.\n\nNote: the local development settings file above is disabled by default, to enable it un-comment the related lines\nin your `settings.php` file and clear the cache.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnuvoleweb%2Fdrupal-component-scaffold","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnuvoleweb%2Fdrupal-component-scaffold","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnuvoleweb%2Fdrupal-component-scaffold/lists"}