DEV Community

Cover image for Create Your Own Lumen Installer (2020)
AibnuHibban
AibnuHibban

Posted on • Updated on

Create Your Own Lumen Installer (2020)

Bismillah

Alhamdulillah, I can still provide knowledge that may be useful for my friends who read ..

Fine, according to the title. We will create our own version of the Lumen Installer. Not only that, this script will also immediately take the latest version of Lumen .. When this article was written Lumen was already version 8

โšก๏ธLumen

Little explanation. Lumen is a Micro-Framework belonging to Laravel which is devoted to creating APIs.

๐Ÿ”จ Creating Lumen Installer

To make Lumen Installer I use Bash so that we can customize more comfortably.

Oh, yes. I made it on Linux, if you are a Windows user, maybe I can adjust it for the settings .. Ok ๐Ÿ˜‰

Next .. To create Lumen Installer, here are the steps

  • Open Terminal CTRL + T

  • Create a Folder with a free name .. For example I use the name "bashku"

mkdir bashku
Enter fullscreen mode Exit fullscreen mode
  • Enter into the folder and create a file with the name "lumen"
cd bashku
touch lumen
Enter fullscreen mode Exit fullscreen mode
  • Then edit with nano (If you want to edit with a text editor, go ahead)
nano lumen
Enter fullscreen mode Exit fullscreen mode
  • Paste the following code
#!/bin/bash

if [ "$1" != "" ]; then
    echo "Sedang Dibuatkan Projectnya di Folder $1"
    composer create-project --prefer-dist laravel/lumen "$1"
else
    echo "Sedang DIbuatkan Projectnay di sini"
    composer create-project --prefer-dist laravel/lumen .
fi
Enter fullscreen mode Exit fullscreen mode
  • Press CTRL + X then Y and ENTER

  • After that go back to the * Directory * initial

cd ..
Enter fullscreen mode Exit fullscreen mode
  • and edit . Bashrc
nano .bashrc
Enter fullscreen mode Exit fullscreen mode
  • Paste the following code at the bottom
export PATH="$PATH:$HOME/bashku"
Enter fullscreen mode Exit fullscreen mode

*The example above is because the folder I previously created was "bashku", it can be adjusted to the name of your folder

  • If you have pressed CTRL + X then Y and ENTER

  • then type source .bashrc in the terminal

source .bashrc
Enter fullscreen mode Exit fullscreen mode
  • After that, try when you are terminated by:
lumen myproject
Enter fullscreen mode Exit fullscreen mode

Will create project lumen in myproject directory (create a new folder)

lumen
Enter fullscreen mode Exit fullscreen mode

Will create a lumen project in the current directory

โ›…๏ธ Closing

How? If there are problems, please discuss it in the comments column... The Bash script above is a basic bash script and is very easy to understand. ๐Ÿ˜ƒ

That's all hopefully useful ...

Thank you ๐Ÿ‘Š

Latest comments (0)