{"id":16362976,"url":"https://github.com/dpi/drupal-local","last_synced_at":"2025-10-26T05:31:14.050Z","repository":{"id":56971704,"uuid":"337607457","full_name":"dpi/drupal-local","owner":"dpi","description":"Personal local Drupal development setup.","archived":false,"fork":false,"pushed_at":"2022-10-03T06:06:50.000Z","size":230,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"1.x","last_synced_at":"2025-02-08T23:45:29.061Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/dpi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-02-10T03:38:11.000Z","updated_at":"2022-08-25T03:17:42.000Z","dependencies_parsed_at":"2022-08-21T12:50:15.118Z","dependency_job_id":null,"html_url":"https://github.com/dpi/drupal-local","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dpi%2Fdrupal-local","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dpi%2Fdrupal-local/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dpi%2Fdrupal-local/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dpi%2Fdrupal-local/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dpi","download_url":"https://codeload.github.com/dpi/drupal-local/tar.gz/refs/heads/1.x","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238264766,"owners_count":19443406,"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","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":[],"created_at":"2024-10-11T02:26:04.437Z","updated_at":"2025-10-26T05:31:08.495Z","avatar_url":"https://github.com/dpi.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Local Drupal Development\n\nThis setup is exclusively for local development only.\n\n# Setup\n\nThis setup has been tested with :\n\n * Apple Silicon M1\n * macOS Monterey\n * Local clone\n * Git\n * Docker for Mac\n * Composer\n * Brew\n\n# Usage\n\n 0. `composer create-project dpi/drupal-local`\n 1. `cp .env.dist .env` and add values.\n 2. `composer install`\n 3. Install Certificates, see _Local TLS_ section below.\n 4. Optionally copy and remove `dist.` prefix from settings files.\n 5. `docker-compose up -d`\n\n## Drupal\n\nDrupal is accessible at https://localhost/\n\n### Installation\n\n```bash\ndocker-compose exec php-cli bash\ndrush si standard -y\n```\n\n### Common tasks\n\n```bash\n# Set Claro as admin theme:\ndrush theme:enable claro \u0026\u0026 drush config:set system.theme admin claro -y \u0026\u0026 drush cr\n```\n\n## Alternative hostnames\n\nWant to use a hostname other than localhost, such as DOMAIN.localhost? (automat-\nically works with Firefox / Chrome) Or any others with editing host file?\n\n 1. Update URLs and hostnames in `.env` file.\n 2. Generate certificates for new hostname (See _Local TLS_).\n 3. `docker-compose up -d`\n\n### Redis\n\n```bash\n# Enable Redis before copying files because new services depend on Redis.module.\ndrush en redis\ncp ./app/sites/default/dist.settings.redis.php ./app/sites/default/settings.redis.php\ncp ./app/sites/default/dist.services.redis.yml ./app/sites/default/services.redis.php\ndrush cr\n```\n\n### Configuration Export/Import\n\nConfig YAML will be exported to `./config/`, alternatively use MySQL dump and\nauto restoration per below.\n\n```bash\ndrush config:export\ndrush config:import\n```\n\n## Local TLS\n\n[Why local HTTPS][local-https]? Just because! Also Secure Cookies! And other\nthings probably.\n\n```bash\nbrew install mkcert nss\n# Replace 'localhost' with alternative hostname, if desired.\nmkcert -cert-file=certificates/primary.pem -key-file=certificates/primary-key.pem localhost\nmkcert -install\n```\n\nMore certificates can be defined in `traefik/config/certificates.yaml`.\n\n [local-https]: https://web.dev/how-to-use-local-https/\n\n## MySQL Dump\n\nDump the MySQL database from the PHPCLI container so the setup can be restarted.\n\n```bash\ndrush sql-dump --result-file=../sql/init/dump.sql\n```\n\nThe dump will be automatically imported if you `docker-compose down` then\nrestart the application. The app will take a few extra seconds to be ready. Tail\nthe database log with `docker-compose logs -f db` to track progress.\n\n## Mailhog\n\nMailhog will capture emails sent by Drupal. There is no need to configure Drupal\nas `sendmail_path` is [configured][sendmail-php-ini].\n\nMailhog is accessible at https://localhost/mailhog/\n\n [sendmail-php-ini]: https://github.com/skpr/containers/blob/master/php/base/conf.d/50_overrides.ini\n\n## Traefik\n\nDashboard is accessible at https://localhost/traefik/\n\n# Development\n\n## PHPStan\n\nOptionally customise PHPStan configuration with\n`cp phpstan.neon.dist phpstan.neon`. The .dist file will be used by default.\n\n```bash\nphpstan analyse\n```\n\n## PHPCS\n\nOptionally customise PHPCS configuration with\n`cp phpcs.xml.dist phpcs.xml`. The .dist file will be used by default.\n\n```bash\nphpcs\n```\n\n## PHPUnit\n\nOptionally customise PHPUnit configuration with\n`cp phpunit.xml.dist phpunit.xml`. The .dist file will be used by default.\n\n```bash\nphpunit\n```\n\n## Blackfire\n\nDefine client and server ID and tokens in .env.\n\n### Web profiling\n\n#### Browser extension\n\nEnable the browser extension as normal.\n\nNavigate to the page you wish to profile, and click 'Profile!' button.\n\nNote: does not work properly if you're using Firefox container tabs. Use a\ncontainer-less tab when profiling in Firefox.\n\n#### Docker compose\n\n`docker-compose exec blackfire blackfire curl http://nginx:8080/`\n\n#### Blackfire CLI app\n\nBlackfire client (`blackfire`) is built into the PHP CLI container\n(`Dockerfile-php-cli`):\n\n```\ndocker-compose exec php-cli bash\nblackfire curl http://nginx:8080/\n```\n\n### CLI app profiling\n\n```\ndocker-compose exec php-cli bash\nblackfire run drush foo\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdpi%2Fdrupal-local","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdpi%2Fdrupal-local","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdpi%2Fdrupal-local/lists"}