PHP8.2 or higher.Composerfor dependency management.npmfor frontend dependency management.Yii22.0.54+ or 22.x.
- Node.js: For advanced asset compilation (optional)
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- Download the template:
git clone --branch 0.1 https://github.com/yii2-extensions/app-basic.git app-basic
cd app-basic- Install dependencies
composer installClone 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 installEnsure the following directories are writable by the web server.
chmod 775 web/assets runtime tests/_outputFor 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- Create database
CREATE DATABASE app_basic CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;- Run migrations (if available)
./yii migrate- Seed test data (optional)
./yii fixture/loadFor advanced asset management.
# Install Node.js dependencies
npm install
# Compile assets
npm run build
# Watch for changes during development
npm run watchAdd 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=1Enable cache components in config/web/components.php.
'cache' => [
'class' => 'yii\caching\FileCache',
],
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'enableStrictParsing' => false,
'rules' => [
// Your URL rules
],
],Once the installation is complete.