Skip to content

Installation Process

Required Credentials

  • SMTP Mail Server Credentials Mailgun
  • Database Credentials

Laraframe is made on Laravel and the installation system is same as Laravel. See Laravel Installation Guide

Note: Before installing Laraframe make sure all required software and PHP extensions are installed properly.

Installing Laraframe On Linux

Laraframe utilizes Composer to manage its dependencies. So, before using Laraframe, make sure you have Composer installed on your machine. To check you have correctly installed composer run composer --version to your server terminal.

If you are not install composer yet then run sudo apt install -y composer to install composer.

Unzip Laraframe project and put it into your server directory (For linux the server directory is /var/www/html). After this go to your project directory and run composer install to download all the dependency.

Directory Permissions

After composer install, you may need to give some directory permissions. Directories within the storage ,bootstrap/cache and resources/lang directories should be writable by your web server or Laraframe will not run.

Example (for ubuntu. may vary for other linux distributions):

sudo chown -R www-data:www-data bootstrap/cache
sudo chown -R www-data:www-data storage
sudo chown -R www-data:www-data resources/lang

Nginx Configuration

The default nginx configuration is not suitable for Laraframe. So you need to configure it. Open /etc/nginx/sites-available/default file with your favorite editor. Here we use vim. If vim is not install then run sudo apt install vim command or use vi instead of vim.

To open run the following command:

sudo vim /etc/nginx/sites-available/default

Remove all from that file and copy & paste the following configuration.

server {
    listen 80 default_server;
    server_name _;
    root /var/www/html/public;

    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Content-Type-Options "nosniff";

    index index.php;

    charset utf-8;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    error_page 404 /index.php;

    location ~ \.php$ {
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        include fastcgi_params;
    }

    location ~ /\.(?!well-known).* {
        deny all;
    }
}

Save it and run nginx -t to check the configuration is correctly configured. If everythins id ok then restart the nginx server. To restart the server run the following command:

sudo service nginx restart

Installing Laraframe On Windows

Laraframe utilizes Composer to manage its dependencies. So, before using Laraframe, make sure you have Composer installed on your machine. To check you have correctly installed composer run composer --version to your server terminal.

If you are not install composer yet then download and run Composer-Setup.exe. It will install the latest Composer version and set up your PATH so that you can call composer from any directory in your command line.

Note: Close your current terminal. Test usage with a new terminal: This is important since the PATH only gets loaded when the terminal starts.

Unzip Laraframe project and put it into your server directory (For Laragon the server directory is C:\laragon\www\).

After this go to your project directory open a terminal and run composer install to download all the dependency.

Environment Setup

The next thing you should do is renaming the .env.example file to .env, After that you need to configure it.

There is two way we can setup environment:

  1. Manual
  2. Web Installer

Manual Setup

Generate Application Key

Set your application key to a random string. Typically, this string should be 32 characters long. If the application key is not set, your user sessions and other encrypted data will not be secure! Follow the command below to generate the key

php artisan key:generate

Open .env file via your favorite text editor and configure it

APP_NAME="My App"                       # Your own exchange name
APP_ENV=local                           # Change it to production once installation is done
APP_KEY=                                # This will be generated by the command given above
APP_DEBUG=true                          # Must be false in production mode
APP_PROTOCOL=http                       # Which protocol you are using
APP_URL=http://laraframe.test           # Your Web Url
APP_INSTALLED=false                     # If don't want to install it vai web installer then set it true
APP_TIMEZONE=UTC                        # Set it to 'UTC' or any timezone you prefer

LOG_CHANNEL=stack

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=homestead                   # Your database name
DB_USERNAME=homestead                   # Your mysql username
DB_PASSWORD=secret                      # Your mysql password

CACHE_DRIVER=file                       # Supported cache driver: file, redis
QUEUE_CONNECTION=redis                  # Supported queue driver: redis
SESSION_DRIVER=file                     # Your session driver
SESSION_LIFETIME=120                    # Session life time in minute 

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

# Your Email Configuration

MAIL_MAILER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_ENCRYPTION=
MAIL_FROM_ADDRESS=                      # The sender email address
MAIL_FROM_NAME=                         # The sender name

NOCAPTCHA_SECRET=secret-key
NOCAPTCHA_SITEKEY=site-key
Database Migration

To make your mysql database ready you need to run following command. Before run this command make sure you have create the database and set it name in the .env file

php artisan migrate
Install initial Data

To push initial data in database, run the following command.

php artisan db:seed

Note: The website won't run without initial data.

To refresh the initial data in database after changing the seeders, run the following command (do not do it once you go live)

php artisan migrate:fresh --seed
Superadmin User Creation

To create superadmin user you need to run the following command. This command will ask some user info.

php artisan make:superadmin

To make them accessible from the web, you should create a symbolic link from public/storage to storage/app/public.

To create the symbolic link, you may use the storage:link command.

php artisan storage:link

Note: This command will help you to visible your media files in your system.

Test Data Seeding

Note: Don't do run it on the production server. It is for testing purpose

If you want to test you system with some test data you may run the following command it will add some test data for you. It may take sometimes to execute, wait for it until it finished.

php artisan db:seed --class=TestSeeder

Web Installer Setup

Before going to installer interface make sure you have correctly given permission to storage, bootstrap/cache and resources/lang (For Windows permission is not necessary) also make sure copy .env.example file to .env file.

Go to http://your-domain.com/install from your web browser. It will show a welcome installer page

Welcome Page

Server Requirement

You cannot move next until all requirements are fullfil.

Server Requirement Page

Directory Permission

You cannot move next until you give permission to storage, bootstrap/cache and resources/lang.

Directories Permission Page

App Environment Setup

Here you can setup your app name and environment like: local, production. Also you can enable/disable debug mode, setup url and log channel.

App Environment Setup Page

Database Configure

Here you can configure your database driver, host, name, port, username, and password.

Database Configure Page

SMTP Mail Server Configure

Here you can configure your STP mail server driver, host, port, username, password, encryption, from address, and from name

SMTP Mail Configure Page

Others

Here you can configure broadcast driver, queue driver, cache driver, session driver, session life time, redis host, port, and password

Others Setup Page

Database Migrations

Database migrations will create all tables that need for this application.

Database Migrations Page

If any error happened then you can rollback migrations and run again.

Database Migrations Output Page

Initial Database Seeding

Initial database seeding will generate some necessary data. Without this data the application won't run properly.

Initial Database Seeding Page

Here is the output of database seeding.

Initial Database Seeding Output Page

Super Admin User Creation

Here you can create your super admin user. You can create only one super admin user but you can create as many admin user you want.

Super Admin User Creation

Test Data Seeding (Optional)

Test data seeding is for testing data. In production you should skip this step.

Test Data Seeding Page

Here is the output of database seeding.

Test Data Seeding Output Page

Final Step

Final Step Page

Remove Laraframe Dev Dependencies

To remove Laraframe dev dependencies run the following command. This will remove all packages that are not necessary in production.

composer install --optimize-autoloader --no-dev

Installing JavaScript Dependencies (Optional)

NPM offers an option which allows to only install app dependencies required for production environment. Use one of the following commands to skip the devDependencies in your package.json

npm install --production

Run the following command to build and minify the JavaScript files.

npm run production