Link Search Menu Expand Document

Environment Initialization

This package ships with a custom Composer command, composer vip. Thanks to its multiple arguments and flags, it is the single entry point to access numerous features.

Before executing the command, we have to install all dependencies, including the library itself.

Installing dependencies

We can start with a โ€œwebsite projectโ€ repository having only the composer.json presented in the previous chapter:

โ”œ ๐Ÿ“„ composer.json

After executing composer install we will end up with a folder structure like the following:

โ”œ ๐Ÿ“„ composer.json
โ”œ ๐Ÿ“„ composer.lock
โ”œ ๐Ÿ“‚ vip
โ”†   โ”œ ๐Ÿ“‚ client-mu-plugins
โ”†   โ”†   โ”œ ๐Ÿ“ my-vip-muplugin
โ”†   โ”†   โ”œ ๐Ÿ“‚ vendor
โ”†   โ”†       โ”œ ๐Ÿ“ composer
โ”†   โ”†       โ”œ ๐Ÿ“‚ inpsyde
โ”†   โ”†       โ”†   โ”œ ๐Ÿ“ vip-composer-plugin
โ”†   โ”†       โ”œ ๐Ÿ“„ autoload.php
โ”†   โ”œ ๐Ÿ“‚ config
โ”†   โ”œ ๐Ÿ“‚ images
โ”†   โ”œ ๐Ÿ“‚ languages
โ”†   โ”œ ๐Ÿ“‚ plugins
โ”†   โ”†   โ”œ ๐Ÿ“ my-vip-plugin
โ”†   โ”œ ๐Ÿ“‚ themes
โ”†   โ”†   โ”œ ๐Ÿ“ my-vip-theme
โ”†   โ”œ ๐Ÿ“‚ vip-config 

The /vip folder and its content (even if most of its folder are empty, right now) resembles very closely the VIP โ€œskeletonโ€, with all the packages placed in the proper place based on their Composer type. This is just the beginning of how the VIP Composer plugins make out life extremely easy.

The real โ€œmagicโ€ happens when running the composer vip command.

The vip command main modes

The composer vip command provided by this package has several parameters and options, but two are its main scopes:

  • **Prepare a local environment for development **
  • Deploy to VIP servers

Local development environment

Regarding the local development environment, the package supports two options:

  • The VIP local development environment which is based on Lando (thus Docker) plus a series of utilities as scripts to make the containerized system as much as possible similar to the โ€œonlineโ€ VIP environments.
  • A more low-level approach, where this package takes care of the heavy lifting of configuring the environment from an application point of view, and ends up with a /public folder which is ready to be uses as the โ€œwebrootโ€ for whatever system consumers might want to use, which could be container-based, good old XAMPP or MAMP, or anything else that can serve web pages executing PHP and MySQL.

The two approaches are documented separately:

Deployment to VIP servers

The /vip folder that resembles the structure expected by VIP and documented in the VIP โ€œskeletonโ€, is a folder that is generated and so should be git-ignored. (Side note: this package does not create a .gitignore file, but you need one to exclude /vip from version control).

However, VIP requires we push to GitHub what we have in that version-control-ignored folder. How can we push to GitHub the content of a folder that is VCS-ignored and whose content is โ€œdisposableโ€ and created dynamically?

The short answer is: we type composer vip --deploy in our terminal and let this package handle it. The details of what happens when we do that is documented in the Deployment chapter.

More on the command

The composer vip command has several options besides the two main usages introduced above. In-depth documentation can be found in the โ€œVIP Commandโ€ chapter.

Configuration

The composer vip command outcome can be customized by configuration placed in the projectsโ€™ composer.json. Learn more about all possible customizations in the โ€œPlugin Configurationโ€ chapter.

Website configuration

Regardless we execute the composer vip command to prepare a local environment or to deploy to VIP servers, this package will always deal with website configuration and create some MU plugins.

These files are not part of the โ€œbuildโ€ process, but are executed and required to run the website. Learn more in the โ€œWebsite Configurationโ€ chapter.