Development Guide
Guide for developers working on the ITeas Tools Integration Platform.
Prerequisites
- Docker and Docker Compose
- Git
- PHP 8.3+ (for local development without Docker)
- Composer
Getting Started
Clone the Repository
bash
git clone <repository-url>
cd web-iteas-tools-integrationSetup Docker Secrets
Create secret files in docker/secrets/:
bash
mkdir -p docker/secrets/app docker/secrets/db
# Database secrets
echo "your_password" > docker/secrets/db/db_password.txt
echo "your_root_password" > docker/secrets/db/db_root_password.txt
# Application secrets
echo "your_cookie_key" > docker/secrets/app/cookie_validation_key.txt
# ... create other required secret filesSee docker-compose-local-dev.yml for the complete list of required secrets.
Start Development Environment
bash
docker-compose -f docker-compose-local-dev.yml up -dThe application will be available at:
- Application: http://127.0.0.1:8000
- Documentation: http://127.0.0.1:8080
- Mailpit (mail testing): http://127.0.0.1:8025
Install Dependencies
bash
docker-compose -f docker-compose-local-dev.yml exec php composer installOr if working locally:
bash
cd src
composer installCommon Development Tasks
Running Migrations
Apply all migrations:
bash
cd src
php yii migrateNon-interactive (for scripts):
bash
php yii migrate --interactive=0Console Commands
Run console commands:
bash
cd src
php yii <controller>/<action>
# Examples:
php yii autotask/sync
php yii jamf/update-devicesRunning Tests
Execute all tests:
bash
cd src
vendor/bin/codecept runRun specific suites:
bash
vendor/bin/codecept run unit
vendor/bin/codecept run functional
vendor/bin/codecept run unit,functionalCache Management
Clear all caches:
bash
cd src
php yii cache/flush-allCode Generation with Gii
When YII_ENV=dev, Gii is available for generating code:
Access at: http://127.0.0.1:8000/gii
Available generators:
- Model Generator
- CRUD Generator
- Controller Generator
- Module Generator
Project Structure
src/
├── assets/ Asset bundles (CSS/JS)
├── commands/ Console controllers
├── components/ Application components
│ ├── interfaces/ Component interfaces
│ ├── traits/ Reusable traits
│ └── validators/ Custom validators
├── config/ Configuration files
│ ├── web.php Web app config
│ ├── console.php Console config
│ ├── db.php Database config
│ ├── coreComponents.php Core components
│ ├── modules.php Module definitions
│ └── params.php Parameters
├── controllers/ Web controllers
├── core/ Core exceptions
├── mail/ Email templates
├── messages/ i18n translations
├── migrations/ Database migrations
├── models/ Models
│ ├── autotask/ Autotask models
│ ├── db/ ActiveRecord models
│ ├── jamf/ Jamf models
│ ├── search/ Search models
│ ├── view/ View models
│ └── yt/ YouTrack models
├── modules/ Yii2 modules
├── runtime/ Generated files
├── tests/ Test suites
├── views/ View templates
├── web/ Web root
└── widgets/ UI widgetsAdding a New Module
- Create module directory:
src/modules/mymodule/ - Create
Module.php:php<?php namespace app\modules\mymodule; class Module extends \yii\base\Module { public $controllerNamespace = 'app\modules\mymodule\controllers'; } - Register in
src/config/modules.php:php'mymodule' => [ 'class' => \app\modules\mymodule\Module::class ] - Create migrations directory and add to console config if needed
Adding a New Component
- Create component class in
src/components/ - Register in
src/config/coreComponents.php:php'myComponent' => [ 'class' => \app\components\MyComponent::class, 'property' => $configurator->getVar('MY_VAR') ] - Access via
Yii::$app->myComponent
Environment Variables
Configuration uses iteas\envLoader\Configurator:
php
$configurator->getVar('VAR_NAME') // Read from env
$configurator->getVar('VAR_NAME_FILE') // Read from file
$configurator->getVar('VAR', 'default') // With default
$configurator->getVar('VAR', false, 'bool') // Type castingDebugging
Debug Module
When YII_ENV_DEV=true:
- Debug toolbar available at bottom of pages
- Access debug panel at
/debug - View requests, queries, logs, profiling
Logging
Logs are written to:
src/runtime/logs/app.log(local dev)- Graylog (when
ENABLE_LOGGING=true)
Code Style
Follow Yii2 conventions:
- PSR-2 coding standards
- Use type hints for PHP 8.3+
- Document classes and methods with PHPDoc
- Keep controllers thin, models fat
- Use components for reusable business logic
Git Workflow
- Create feature branch from
master - Make changes and commit
- Push and create merge request
- After review, merge to
master - Tags trigger production deployment
