Skip to content

Latest commit

 

History

History
153 lines (105 loc) · 2.67 KB

installation.md

File metadata and controls

153 lines (105 loc) · 2.67 KB

Installation guide

System requirements

  • PHP 8.2 or higher.
  • Composer for dependency management.
  • npm for frontend dependency management.
  • Yii2 2.0.54+ or 22.x.

Optional requirements

  • Node.js: For advanced asset compilation (optional)

Installation methods

Method 1: Using composer (recommended)

Create a new project using the Yii App Basic template.

composer create-project --prefer-dist yii2-extensions/app-basic:^0.1 app-basic
cd app-basic

Method 2: Manual installation

  1. Download the template:
git clone --branch 0.1 https://github.com/yii2-extensions/app-basic.git app-basic
cd app-basic
  1. Install dependencies
composer install

Method 3: Using Git

Clone the repository and set up your project.

git clone --branch 0.1 https://github.com/yii2-extensions/app-basic.git app-basic
cd app-basic
rm -rf .git
git init
composer install

Post-installation setup

Directory permissions

Ensure the following directories are writable by the web server.

chmod 775 web/assets runtime tests/_output

Built-in PHP server

For development purposes.

# Method 1: Using PHP built-in server
php -S localhost:8080 -t web

# Method 2: Using Yii console command
./yii serve

# Method 3: Custom host and port
./yii serve --host=0.0.0.0 --port=8080

Development setup

Database setup

  1. Create database
CREATE DATABASE app_basic CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
  1. Run migrations (if available)
./yii migrate
  1. Seed test data (optional)
./yii fixture/load

Asset compilation

For advanced asset management.

# Install Node.js dependencies
npm install

# Compile assets
npm run build

# Watch for changes during development
npm run watch

Performance optimization

Enable OPcache

Add to your php.ini.

opcache.enable=1
opcache.enable_cli=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60
opcache.fast_shutdown=1

Configure caching

Enable cache components in config/web/components.php.

'cache' => [
    'class' => 'yii\caching\FileCache',
],
'urlManager' => [
    'enablePrettyUrl' => true,
    'showScriptName' => false,
    'enableStrictParsing' => false,
    'rules' => [
        // Your URL rules
    ],
],

Next steps

Once the installation is complete.