This page is about the first steps in using Kiwa. How to install it and run a simple website.
Table of contents
Kiwa is made for the use with Composer. Be sure to get it at first.
Use your CLI and Composer to create a new website by running:
$ composer create-project kiwa/website-skeleton my-project
my-project by your needs.
Move to your project directory, for example by running:
$ cd my-project
Create your code repository, for example by running:
$ git init
By running the installation a lot of basic files will be created. Those files can be committed to your repository.
Running the website
To access the website from public, point your domain to the
public directory, so the
index.php will be used.
To run the website in a local environment, run
$ php -S 127.0.0.1:8000 public/index.php
If you have the Kiwa Console installed, simply run
$ php bin/console server:start
http://127.0.0.1:8000 in your browser then.
Adding the Kiwa Console
The Kiwa Console is a useful helper to manage your website. If you don't have it installed yet, add it to your project by running
$ composer require kiwa/console
The console is now available and can be used over the CLI. Take a look at the available commands by running
$ php bin/console
Adding a new page
Let's use the Kiwa Console to create a new page. At first, run
$ php bin/console page:create
The CLI will ask for the page name. The page name will be part of the URL later. Let's write
test-page here and press
Now the Console asks if we want to root that URL to a
phtml file with the same name. That's okay, so simply confirm it.
After that, we're getting asked about the page type. We want to define it as
website what is the default value here and press
Enter again to confirm.
For our first page, we don't want a second level subpage, so we deny the next question by again pressing
Now the Console asks if the page shall have dynamic subpages. We don't want that here in our example, so we deny the question again by pressing
After that, the Console asks for the language code. We write
en here and confirm.
Here comes the SEO part: The next question is about the page title, and we enter
Test Page. After that, the Console asks for the description: let's write
Description for our Test Page.
Now comes the last question: Do we want to add another language? At the moment, we don't want so, so let's deny the question by pressing
We're finished! The Console tells, that it has created the page
test-page and we notice some changes in our project now:
htmlfolder contains a file
config/config.phpthere is a new part of code. It looks like that:
<?php // ... $configGenerator = new ConfigGenerator(); $configGenerator // ... ->addPage(PageGenerator::create() ->setLanguageCode('en') ->setName('test-page') ->setPageTitle('Test Page') ->setOGTitle('Test Page') ->setOGDescription('Description for our Test Page') ->setDescription('Description for our Test Page') ->setPageType('website') ->setFile('test-page') ) ; return $configGenerator->getConfig();
And for sure, the page is already available to access it by a request. Open in your browser
http://127.0.0.1:8000/test-page.html and you will see the welcome message that says
Welcome to page test-page!.