# Getting started
To run a local development version of LocalGov Drupal following our recommended setup, you will need the following.
# Installing LocalGov Drupal
To install LocalGov Drupal use the Composer-based project template (opens new window).
MY_PROJECT to whatever you'd like your folder to be called.
composer create-project localgovdrupal/localgov-project MY_PROJECT --no-install
Change directory into the MY_PROJECT directory and run lando start.
cd MY_PROJECT lando start
Once lando has finished building, use lando to run composer install and the site installer.
lando composer install lando drush si localgov -y
Note: As you might be running a different version of PHP on your host machine from the version that Lando runs, it is advisable to run composer install from within Lando. This ensures dependencies reflect the PHP version that the webserver is actually running.
# Installing from the UI (alternative)
Assuming that your settings.local.php can connect to the database and your file permissions are as expected you can visit your local URL which by default in the Lando setup is
http://localgov.lndo.site/ and you will encounter the Drupal site installation form.
When you reach the profile selection screen make sure you choose 'LocalGovDrupal' before continuing, otherwise you might have to restart the entire process.
Next Drupal will install all the default configuration and modules for the profile before reaching the site configuration form where you can setup your site name and user 1 details, you can always change these later.
And that's it! You should now be redirected to your site and logged in as user 1.
# Composer notes
If developing locally and you want to force composer to clone again
from source rather than use composer cache, you can add the
composer create-project localgovdrupal/localgov-project MY_PROJECT --stability dev --no-cache
If you just want to pull in the latest changes to LocalGov Drupal run composer
update with the
composer update --no-cache
If you want to be sure you are getting the latest commits when developing, clearing composer cache, deleting the folders and re-running composer update seems to be a solid approach:
rm -rf web/profiles/contrib/ web/modules/contrib/ web/themes/contrib/; composer clear-cache; composer update --with-dependencies --no-cache; lando start; lando drush si localgov -y;
If you run into memory limit errors (opens new window)
when running Composer commands, prefix the commands with
For example, to install the project run:
COMPOSER_MEMORY_LIMIT=-1 composer create-project --stability dev localgovdrupal/localgov-project MY_PROJECT
We accept contributions from anybody and any level of involvement is greatly appreciated, even small things like reporting issues.
You can explore more about how to get involved in the Contributing section.
# Issue tracking
In the early development stages, most issues will be tracked in this repository https://github.com/localgovdrupal/localgov/issues (opens new window).
Development issues relating to specific projects or module should be tracked in the project repository. In the future we might set up a separate repository for centralised issue tracking of bug reports for end users.
# Development setup
The main development environment in use is currently Lando (opens new window) – a Docker based development environment that works on Linux, MacOS and Windows.
Jump to Working with Lando for more information.
# Coding standards
PHP CodeSniffer is installed as a dev dependency by Composer and configured to use Drupal coding standards and best practices. It is a good idea to run these before committing any code. All code in pull requests should pass all CodeSniffer tests.
To check code using Lando run:
To attempt to automatically fix coding errors in Lando run:
# Coding standards resources
# Running tests
phpunit.xml.dist file contains configuration for automatically
running the LocalGov Drupal test suite.
To run all LocalGov Drupal tests with Lando use:
To run all the tests for a specific module use:
lando phpunit web/modules/contrib/localgov_my_module
Tests can be filtered using the
--filter option. To only run a specific test
lando phpunit --filter=myTestName