front-end, systems,

First time GravCMS Developer

Follow Dec 12, 2017 · 4 mins read
First time GravCMS Developer
Share this

For an upcoming project I had to put my GravCMS Developer hat on and because I hadn’t used PHP recently on my dev virtual box was starting from nearly nothing.  It is easier to install PHP composer globally whilst doing dev.  I ran GravCMS on port 80 for dev and used the sudo command – in production, I guess you would proxy to grav using apache or nginx and use a port above 1024 so you don’t have to be root.

There are other ways to begin, but I thought I would install PHP composer globally…for giggles…

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"

php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"

php composer-setup.php --filename=composer --install-dir=/usr/local/bin

Install some php extensions

sudo apt-get install php7.0-gd php7.0-curl php7.0-openssl php7.0-curl php7.0-zip php7.0-mbstring php7.0-xml

And to continue a GravCMS installation,

composer create-project getgrav/grav ~/webroot/grav

If there’s a permission problem with this error

bin/grav install handling the post-create-project-cmd event returned with error code 126

Just cd webroot/grav and run the grav executable with php

php bin/grav install

And then run grav (on the interfaces to listen on, if you’re on a virtual machine, use that IP address and not localhost) sudo php -S 192.168.80.84:80 system/router.php

mylo@proxy:~/webroot/grav$ sudo php -S 192.168.80.84:80 system/router.php 

PHP 7.0.22-0ubuntu0.16.04.1 Development Server started at Wed Dec  6 18:18:28 2017

Listening on http://192.168.80.84:80

Document root is /home/mylo/webroot/grav

Press Ctrl-C to quit.

[Wed Dec  6 18:18:31 2017] 192.168.80.82:56967 [200]: /

[Wed Dec  6 18:18:31 2017] 192.168.80.82:56968 [200]: /user/themes/antimatter/css/pure-0.5.0/grids-min.css

[Wed Dec  6 18:18:31 2017] 192.168.80.82:56970 [200]: /user/themes/antimatter/css-compiled/nucleus.css

[Wed Dec  6 18:18:31 2017] 192.168.80.82:56972 [200]: /user/themes/antimatter/css-compiled/template.css

[Wed Dec  6 18:18:31 2017] 192.168.80.82:56974 [200]: /user/themes/antimatter/css/font-awesome.min.css

[Wed Dec  6 18:18:31 2017] 192.168.80.82:56976 [200]: /user/plugins/markdown-notices/assets/notices.css

[Wed Dec  6 18:18:31 2017] 192.168.80.82:56978 [200]: /user/themes/antimatter/css/slidebars.min.css

[Wed Dec  6 18:18:31 2017] 192.168.80.82:56980 [200]: /system/assets/jquery/jquery-2.x.min.js

[Wed Dec  6 18:18:31 2017] 192.168.80.82:56982 [200]: /user/themes/antimatter/js/modernizr.custom.71422.js

[Wed Dec  6 18:18:31 2017] 192.168.80.82:56984 [200]: /user/themes/antimatter/js/antimatter.js

[Wed Dec  6 18:18:31 2017] 192.168.80.82:56986 [200]: /user/themes/antimatter/js/slidebars.min.js

[Wed Dec  6 18:18:31 2017] 192.168.80.82:56991 [200]: /user/themes/antimatter/fonts/fontawesome-webfont.woff2?v=4.7.0

[Wed Dec  6 18:18:32 2017] 192.168.80.82:56998 [200]: /user/themes/antimatter/images/favicon.png

gravcms-developer

GravCMS Developer: Install Admin Panel

These are the summary steps from the admin panel intro pages.

Go to the webroot

mylo@proxy:~/webroot/grav$ php bin/gpm version -f

You are running Grav v1.3.10

Then do the install (dev mode I’m using sudo for quick port 80 access, and have directories with permissions created as such)

mylo@proxy:~/webroot/grav$ sudo php bin/gpm install admin

GPM Releases Configuration: Stable

The package admin is already installed, overwrite? [y|N] y

Preparing to install Admin Panel [v1.6.7]

  |- Downloading package...   100%

  |- Checking destination...  ok

  |- Installing package...    ok                             

  '- Success! 

Clearing cache

Cleared:  /home/mylo/webroot/grav/cache/twig/*

Cleared:  /home/mylo/webroot/grav/cache/doctrine/*

Cleared:  /home/mylo/webroot/grav/cache/compiled/*

Touched: /home/mylo/webroot/grav/user/config/system.yaml

GravCMS Developer - Admin Panel

And after admin user creation you get to your GravCMS Developer Dashboard.

GravCMS Developer Dashboard

GravCMS Developer: Install a theme close to what you will use

Get to the themes part of the admin panel and at the top of the screen “Add+”.   I’m roughly looking at doing a single landing page for a crypto project.  The landio theme is quite close from memory.

add landio theme to GravCMS

And that’s where we end….abruptly – I’ve fallen into a development hole of 15 or so tabs…and the flow is gone 😀 It was easier to download a skeleton and just use that from scratch rather than try to install a theme.

This is a useful must-have-gravs-plugin page.

Written by