Laravel
Laravel is a popular PHP framework for web development. This article introduces how to install system libraries and tools for Laravel version 5.7.
Local development environment
Install PHP 7 packages
Laravel 5.7 recommends PHP >= 7.1.3. PHP 7.2 is shipped in openSUSE Tumbleweed and Leap 15.0. If you are using an older version of openSUSE Leap, you need to add OBS repository devel:languages:php (check here).
sudo zypper install php7 php7-openssl php7-pdo php7-mbstring php7-tokenizer php7-xmlreader php7-xmlwriter php7-ctype php7-json php7-sqlite php-composer
Install Node.js packages
sudo zypper install nodejs npm
Install Laravel installer
composer global require laravel/installer
You need to manually add composer bin directory to system $PATH.
Create new project
laravel new mywebsite cd mywebsite npm install
Clone existing project
Copy .env.example
to .env
file.
composer install npm install
Run:
php artisan key:generate
Copy the output and save it in .env
:
APP_KEY=<the_key_you_generated>
Edit database configuration
Edit .env file and replace database configuration:
DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=homestead DB_USERNAME=homestead DB_PASSWORD=secret
with (if you prefer SQLite):
DB_CONNECTION=sqlite DB_DATABASE=<sqlite_file_path>
You need to make sure the file <sqlite_file_path> exist.
touch <sqlite_file_path>
Run web server
php artisan serve
Open http://127.0.0.1:8000/ in your browser to see if it works.
Production server environment
PHP runtime and tools
sudo zypper install php7 php7-openssl php7-pdo php7-mbstring php7-tokenizer php7-xmlreader php7-xmlwriter php7-ctype php7-json php7-opcache php-composer
Web server
NGINX (recommended)
Apache
sudo zypper install apache2 apache2-mod_php7
Database
Do NOT install phpMyAdmin on a production server!
MariaDB
sudo zypper install mariadb php7-mysql
PostgreSQL
sudo zypper install postgres php7-pgsql