Developing a Website
Develop a website
Create a new website
Enter the container and run:
site-create www.example.com
Note: Creating the website requires as a subsequent step that you configure its repository on GitHub and add the site to the $DEPLOYER_DIR/sites.php file using the site-add command.
Clone a website
Enter the container and run:
site-clone www.example.com [email protected]:example/example.git
Note: When cloning an existing website, the site is automatically added to the $DEPLOYER_DIR/sites.php file.
Visit the website in the browser
On your machine, configure /etc/hosts by adding the local development domain:
echo "127.0.0.1 www.example.com.local" | sudo tee -a /etc/hosts
Then you can access the website via the URL https://www.example.com.local:8443
The language of the website
The texts of the templates are in English and are translated with the domain website: the Spanish translations are in resources/translations/website+intl-icu.es.php, and App\Translation\WebsiteTranslationResourceProvider gives them to the translator. The language of the site is the one of the environment variable APP_LOCALE (es, for example), or English if it is not set. A text that you add to a template is written in English with the filter |trans, and its translation goes in the catalogue; the test tests/src/Translation/WebsiteMessagesTest.php fails if a text is missing.
The contact page
The contact page is the one of derafu/contact-form: derafu/foundation requires it and imports its routes and its services, so the site has no controller of its own for it.
The tests of the website
The site comes with tests that run it as it is: tests/src/WebsiteTest.php starts the kernel with the real configuration of config/, makes a request to the home page and to /contact, and checks the response in English and in Spanish. tests/src/Translation/WebsiteMessagesTest.php audits that every text of the templates has its translation.
The kernel of the tests runs in debug mode on purpose. Outside of debug mode the container is cached in var/cache/<env>/ and a later run reuses it, so a change in config/services.yaml would not be seen. If you test the kernel in your site, do the same, or delete var/cache/ before running.