Grav - GPM
GPM stands for Grav Package Manager which is used to install, update, un install and list the available plugins on the Grav repository. GPM executes the commands using command line interface such as terminal or cmd.
You can access CLI very easily. On Windows, you can access through cmd, on Mac you can access through Terminal and on Linux you can use shell. In windows, you can't use UNIX style commands. To use these just install the msysgit package which provides GIT and GIT BASH and provides UNIX style commands on Windows.
To list the available commands on the Grav repository type the command as −
$ bin/gpm list
You will receive the following −
You can help the commands by adding help to the line as shown below −
$ bin/gpm help install
You can find the version of PHP on the command line interface by using the following command −
$ php -v
How Does it work?
When you run the commands on the command line interface, GPM automatically downloads the required data from the GetGrav.org site. It includes all the details of available packages and also determines the packages that need to be installed and which packages needs to be updated.
When you are downloading the packages from the repository, the Grav repository gets cached locally and no request will be able to contact the GetGrav.org server after the cache has been generated.
Some commands come with the --force (-f) option, which forces to re-fetch the repository. Using this option, there is no need to wait for 24 hours cycle before cache gets cleared.
You can download the available packages from the Grav repository using some commands. To make use of the command, open your terminal and navigate to your root of the Grav folder and type as bin/gpm <command>.
The index command is used to list the available plugins, themes in the Grav repository. Use the below command in your terminal to list out the available resources.
$ bin/gpm index
Each line defines the name of the plugin or theme, slug, version of plugin or theme and also displays whether it is installed or not.
The info command is used to display the information about package such as author, version, date and time of last updated, repository of package, download link of package, license information etc.
As the name implies the install command installs the required resources for the package from the Grav repository.
You can use the following command to install the required package.
$ bin/gpm install package_name
If you try to install an already installed package, then it informs what to do next.
If you type Y, it will overwrite on an already installed package and if you type N, it will abort the installation process.
The update command informs about the package that need to be updated. Suppose if all packages are up to date, then it will say nothing to update.
$ bin/gpm update
The self-upgrade command is used to upgrade the Grav to the latest version. Use the following command to upgrade the Grav.
$ bin/gpm self-upgrade
If you are using the latest version of Grav, then it will display a message saying "You are already running the latest version of Grav" along with the date of release and the time as shown in the screen.