/Twill-starter

Starter twill larvel (5.8.* / 1.2.2)

Primary LanguagePHPMIT LicenseMIT

Twill-laravel

Twill Laravel's documentation Twill v 1.2+ to run in windows OS.

Requirements

  • docker >= 17.9
  • php >= 7.2
  • composer >= 1.6.0
  • Laravel = 5.8
  • npm >= 6.4
  • MySQL >= 5.7

Installation

# Add app url & app + appAdmin db endpoint to your host config
# ---
# 127.0.0.1 twill-laravel.local admin.twill-laravel.local twill-app
# Build docker servers
$ docker-compose up -d
# Install PHP dependencies from local composer
$ composer install
# OR
# Install PHP dependencies from docker container composer
$ docker exec -it twill-laravel composer install

New Project ?

Installations

This tutorial just will guide you to the right way during your installing twill.

Make sure you alreday have composer cli in your computer (If you don't have yet, check this link https://getcomposer.org/).

Installing Laravel 5.8.*

Install the dependencies and devDependencies and start the server.

$ composer create-project laravel/laravel twill-laravel  "5.8.*" --prefer-dist
$ cd \twill-laravel
Installing Laravel 1.2.2

Twill is a package for Laravel applications [https://twill.io/docs/#Composer], installable through Composer:

$ composer require area17/twill:"1.2.2" 

Twill will automatically register its service provider cause we are using Laravel 5.8 .

Now run the twill artisan command:

$ php artisan twill:install

This command will migrate your database [https://twill.io/docs/#artisan].

.env

Now add the following code to your .env file:

APP_URL=twill-laravel.local
ADMIN_APP_URL=admin.twill-laravel.local

That make you should be able to login at admin.twill-laravel.local

npm

Add the following npm script to your project's "package.json" [https://twill.io/docs/#npm]:

"twill-build": "rm -f public/hot && npm run twill-copy-blocks && cd vendor/area17/twill && npm ci && npm run prod && cp -R public/* ${INIT_CWD}/public",
"twill-copy-blocks": "npm run twill-clean-blocks && mkdir -p resources/assets/js/blocks/* && cp -R resources/assets/js/blocks/* vendor/area17/twill/frontend/js/components/blocks/customs/",
"twill-clean-blocks": "rm -rf vendor/area17/twill/frontend/js/components/blocks/customs/"

Build Twill's admin console UI assets using:

$ npm run twill-build --script-shell bash

Add and install the following dev dependencies to your project's "package.json":

"devDependencies": {
  "concurrently": "^3.5.1",
  "watch": "^1.0.2"
}

And the following npm scripts:

"twill-dev": "mkdir -p vendor/area17/twill/public && npm run twill-copy-blocks && concurrently \"cd vendor/area17/twill && npm ci && npm run hot\" \"npm run twill-watch\" && npm run twill-clean-blocks",
"twill-watch": "concurrently \"watch 'npm run twill-hot' vendor/area17/twill/public --wait=2 --interval=0.1\" \"npm run twill-watch-blocks\"",
"twill-hot": "cd vendor/area17/twill && cp -R public/* ${INIT_CWD}/public",
"twill-watch-blocks": "watch 'npm run twill-copy-blocks' resources/assets/js/blocks --wait=2 --interval=0.1"

Now run:

$ npm install
$ npm run twill-dev --script-shell bash

#By Angelo