A Step by step guide to up and running PHP Laravel in android.

https://codingfx.blogspot.com/2017/11/a-step-by-step-guide-to-up-and-running.html?m=1

Skip to main content

CodingF

Requirements:

- Android Device with Android 6.0 or higher - Termux app - decent internet connection

Step 1:

Download and install Texmux on your android device.

Step 2:

On your device, open the Settings.
Go to Apps and open it.

Tap the ‘Termux’ app see more.

Go to “Permissions”, Allow Storage Access.

Step 3: Update Termux default repositories

Update repositories

$ cd ~ $ apt update && apt upgrade

Install core utilities

$ apt install coreutils

Install curl

$ apt install curl

Step 4: Install Git + PHP

$ apt install git php

Step 7: Install Composer

To install composer visit Composer for Termux and follow the instructions

Installation

$ curl -L https://github.com/yuloh/composer-termux/releases/download/0.0.1/composer.phar -o composer.phar $ chmod +x ./composer.phar $ mv ./composer.phar /data/data/com.termux/files/usr/bin/composer

NOTE: Composer scripts

Any bin scripts you install (phpunit, psysh, etc) will need to be patched to work with Termux. You can just run$ termux-fix-shebang <my-file>

to rewrite the path. Here’s an example:$ composer global require psy/psysh $ termux-fix-shebang ~/.composer/vendor/bin/psysh

Step 6: Setup Storage

This will make a symlink folder at $HOME/storage or ~/storage$ termux-setup-storage

The contents of the created $HOME/storage folder are symlinks to different storage folders:

$ ~/storage/shared

The root of the shared storage between all apps.$ ~/storage/downloads

The standard directory for downloads from e.g. the system browser.$ ~/storage/dcim

The traditional location for pictures and videos when mounting the device as a camera.$ ~/storage/pictures

Standard directory in which to place pictures that are available to the user.$ ~/storage/music

Standard directory in which to place any audio files that should be in the regular list of music for the user.$ ~/storage/movies

Standard directory in which to place movies that are available to the user.$ ~/storage/external

Symlink to a Termux-private folder on external storage (only if external storage is available).

Step 7: Installing Laravel

Make a directory named ‘laravel’ at ~/storage/ and cd into it

— You need to allow Termux storage permission to access your internal/external storage$ cd ~/storage/shared $ mkdir laravel && cd laravel

To create a new Laravel project, run the following command we name it blog:
— Installation will take a little while.$ composer create-project --prefer-dist laravel/laravel blog

After it’s complete cd into blog directory$ cd blog

Generate application key before serving laravel.$ php artisan key:generate

Now run our newly created project using Laravel’s own Artisan command line interface$ php artisan serve

Access localhost:8000 URL in the browser, should show the Laravel home screen by now.
If it doesn’t show, double check the steps above done correctly.

Step 8: Install sqlite

$ apt install sqlite

Modify laravel’s .env file to use sqlite database

DB_CONNECTION=sqlite DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=database.sqlite DB_USERNAME=homestead DB_PASSWORD=secret

The DB_DATABASE path points to a database.sqlite file. This file does not exist yet, so we need to create it.$ touch database.sqlite

now go to config/database.php and modify some lines'default' => env('DB_CONNECTION', 'mysql'),

to'default' => env('DB_CONNECTION', 'sqlite'),

Step 9: Create Laravel’s Auth scaffolding

$ php artisan make:auth $ php artisan migrate

Setp 10: Run Laravel

$ php artisan serve

Note: Please Update if anything missing or wrong. Thank you.

Labels: Android How to Termux Tutorial

Comments

  1. Unknown30 January 2018 at 04:48jaw-dropping amazing step-by-step post!
    It would have been even better and more complete if you had mentioned vim (or other editor) and ls -a command to find .env file at step 8 Reply
  2. Ed Rusano8 December 2018 at 03:11Good tutorial to get inspired working with Laravel on Android devices. It is becoming more natural and straightforward to work with those frameworks using Termux.

    Let’s walk through your steps and see how it could be done better:

    Step5 (typo 7): no need to install composer derivative for termux. Instead install composer from standard https://getcomposer.org preferably using bash script. Before installing use the termux command termux-chroot that will mimic all root paths like /usr/bin, etc. When installing global packages like laravel set path to ~/. composer/vendor/bin in your user profile file.

    Step6: No need to use external storage configuration. You can do your development directly in Termux using variaty of editors like micro if vim is not confortable enough. Reply
  3. Andro-Man30 May 2020 at 05:02Great tutorial bro
    But when i try to make key for artisan it says that my openssl doesn’t support sha384
    Any help !??Reply

Post a Comment

About Me

Unknown

Visit profile

Archive

Labels

Report Abuse

Powered by Blogger

Leave a comment

Design a site like this with WordPress.com
Get started