EIEIOTECHNOVATION
← Training programmes

EIEIO / PROGRAMMING & DEVELOPMENT

Web Development with Yii Framework

Course outline

5 days

Duration

Web Development with Yii Framework

5 days

Course Objective

The primary objective of this 5-day intensive training course is to provide participants with comprehensive knowledge and hands-on experience in developing web applications using the Yii Framework.

By the end of the course, participants will:

  • Grasp the Model-View-Controller (MVC) pattern as implemented in Yii and how to apply it in real-world projects.
  • Install and configure the Yii environment, manage dependencies, and understand the Yii directory structure.
  • Master Yii's Active Record for database management, implement CRUD functionalities, and optimize database interactions.
  • Build dynamic, responsive, and secure web applications using Yii's advanced features, widgets, and helpers.
  • Implement security best practices, such as input validation, CSRF protection, and user authentication, while optimizing application performance with caching and profiling.
  • Develop and consume RESTful APIs using Yii, integrating external services and enabling seamless communication between frontend and backend.
  • Apply testing methodologies, including unit, functional, and acceptance testing, and learn how to deploy Yii applications to production environments.
  • Follow best coding standards, design patterns, and project management strategies for scalable and maintainable Yii applications.

Prerequisites

Before attending this course, participants should have:

  • Familiarity with PHP syntax and object-oriented programming concepts.
  • Basic knowledge to create and style web pages.
  • Experience with SQL and relational databases like MySQL.
  • Installed on your development machine for managing PHP dependencies.
  • Comfort with navigating and executing commands in a terminal or command prompt.

Target Audience

Web Developers who have a basic understanding of PHP and want to expand their knowledge of the Yii Framework to build enterprise-level web applications.

Course Methodology

  • Instructor-Led Presentations and Lectures:
  • Hands-On Practical Exercises:
  • Project
  • Interactive Q&A and Problem-Solving Sessions
  • Homework and Self-Study

Day 1: PHP Recap & Introduction to Yii Framework

  • Introduction to PHP
  • Overview of PHP and its role in web development.
  • PHP versions and their features.
  • Setting up a PHP development environment.
  • PHP Basics Refresher
  • Syntax and language constructs.
  • Variables, data types, and operators.
  • Control structures (if-else, switch, loops).
  • Functions and OOP in PHP
  • Defining and invoking functions.
  • Introduction to Object-Oriented Programming (OOP) in PHP.
  • Classes, objects, inheritance, and interfaces.
  • Advanced PHP Concepts
  • Namespaces and autoloading.
  • Error handling and exceptions.
  • Working with arrays and strings.
  • PHP Best Practices
  • Coding standards (PSR-1, PSR-12).
  • Writing clean, maintainable code.
  • Security best practices (input validation, preventing XSS and SQL Injection).
  • Working with PHP and Databases
  • Introduction to PDO and MySQLi.
  • Performing CRUD operations using PHP.
  • Understanding prepared statements and parameter binding.
  • Introduction to Yii Framework
  • History and evolution of Yii.
  • Key features and benefits.
  • Comparison with other PHP frameworks (Laravel, Symfony).
  • Understanding Yii's philosophy and design principles.
  • Yii Versions Overview
  • Differences between Yii 1, Yii 2, and Yii 3.
  • Migrating from older versions to Yii 3.
  • Yii Ecosystem and Extensions
  • Overview of the Yii Extension Library.
  • Installing and managing extensions via Composer.
  • Popular extensions and their use cases.
  • Setting Up the Development Environment
  • Installing PHP, Composer, and a web server (Apache/Nginx).
  • Setting up a local development environment (e.g., XAMPP, WAMP, Laravel Homestead, Docker).
  • Configuring IDEs/editors for Yii development (PHPStorm, VSCode).
  • Installing Yii Framework
  • Using Composer to create a new Yii project.
  • Exploring the directory structure in detail.
  • Configuring environment-specific settings (development, production).
  • Creating Your First Yii Application
  • Running the application locally.
  • Exploring the default project setup and components.

Day 2: Models and Database Interaction

  • Understanding MVC in Yii
  • Deep dive into Models, Views, Controllers.
  • How Yii implements MVC.
  • Separation of concerns and best practices.
  • Active Record in Yii
  • Defining models and their attributes.
  • Validation rules and scenarios.
  • Relationships between models (hasOne, hasMany, etc.).
  • Advanced querying with Active Record.
  • Database Configuration
  • Setting up multiple database connections.
  • Using environment variables for secure configurations.
  • Managing different environments (development, staging, production).
  • Database Migrations
  • Creating and applying migrations.
  • Rolling back and managing schema changes.
  • Best practices for version control with migrations.
  • Seeding and Fixtures
  • Creating seed data for development and testing.
  • Using Yii's fixture system for testing.
  • CRUD Operations with Gii
  • Generating models, controllers, and views using Gii.
  • Customizing generated code for specific needs.
  • Understanding Gii templates and creating custom templates.
  • Advanced Active Record Techniques
  • Scopes and reusable query methods.
  • Handling large datasets and pagination.
  • Optimizing queries for performance.
  • Hands-On Exercise:
  • Create a comprehensive database schema for a multi-user blog application with categories, tags, and comments.
  • Generate models using Gii and implement advanced CRUD operations.
  • Seed the database with sample data.

Day 3: Controllers, Views, and User Interface

  • Controllers and Actions
  • Creating and configuring controllers.
  • Action methods and parameters.
  • Filters and behaviors in controllers.
  • Routing and URL Management
  • Pretty URLs configuration.
  • Custom URL rules and RESTful routing.
  • Handling dynamic and parameterized URLs.
  • RESTful Controllers
  • Building RESTful APIs using Yii controllers.
  • Handling different HTTP methods (GET, POST, PUT, DELETE).
  • Response formatting and content negotiation.
  • Views and Layouts
  • Rendering views from controllers.
  • Using layouts for consistent design across pages.
  • Theme management and applying different themes.
  • Using partial views and view components for reusable UI elements.
  • Yii's Templating and Asset Management
  • Managing assets with Asset Bundles.
  • Integrating third-party CSS and JS libraries.
  • Using Yii's asset management for efficient loading.
  • Widgets and Helpers
  • Utilizing built-in widgets (e.g., GridView, ListView, DetailView, Pjax).
  • Creating custom widgets for specialized UI components.
  • Using HTML and URL helpers for generating dynamic content.
  • Responsive Design and Accessibility
  • Implementing responsive layouts using Bootstrap (integrated with Yii).
  • Ensuring accessibility standards (ARIA roles, keyboard navigation).
  • Hands-On Exercise:
  • Build custom views and layouts for the blog application, ensuring responsiveness and accessibility.
  • Implement navigation, sidebars, and dynamic content using Yii widgets.
  • Integrate a third-party UI library (e.g., Select2, DatePicker) into the application.

Day 4: Advanced Features and Security

  • User Authentication and Authorization
  • Yii's built-in authentication mechanisms.
  • Implementing Role-Based Access Control (RBAC).
  • Managing user roles, permissions, and assignments.
  • Integrating third-party authentication providers (OAuth, LDAP).
  • Forms and Input Handling
  • Creating and validating forms with ActiveForm.
  • Handling file uploads securely.
  • Implementing dynamic form fields and AJAX validation.
  • Session and Cookie Management
  • Managing user sessions.
  • Securely handling cookies and persistent logins.
  • Implementing "Remember Me" functionality.
  • AJAX and RESTful APIs
  • Integrating AJAX for dynamic content updates without full page reloads.
  • Building RESTful APIs with Yii's REST controller.
  • Authenticating API requests (OAuth2, JWT).
  • Consuming external APIs within Yii applications.
  • Security Best Practices
  • Preventing common web vulnerabilities (XSS, CSRF, SQL Injection).
  • Implementing input validation and sanitization.
  • Secure password storage (hashing algorithms, salting).
  • Using HTTPS and secure headers.
  • Caching Strategies
  • Implementing data caching, fragment caching, and HTTP caching.
  • Utilizing Yii's caching components (FileCache, MemCache, Redis).
  • Cache invalidation and consistency strategies.
  • Performance Optimization
  • Profiling and identifying bottlenecks.
  • Optimizing database queries and using indexing.
  • Implementing lazy loading and eager loading where appropriate.
  • Hands-On Exercise:
  • Add comprehensive user authentication and RBAC to the blog application.
  • Create a RESTful API endpoint for managing blog posts with proper authentication.
  • Implement AJAX-based commenting and liking features on blog posts.
  • Secure the application against common vulnerabilities and optimize its performance.

Day 5: Testing, Deployment, and Best Practices

  • Testing in Yii
  • Unit testing with PHPUnit.
  • Functional and acceptance testing with Codeception.
  • Writing comprehensive test cases for models, controllers, and views.
  • Test-Driven Development (TDD) principles.
  • Debugging and Profiling
  • Using Yii Debug Toolbar effectively.
  • Profiling application performance.
  • Identifying and resolving performance issues.
  • Continuous Integration and Continuous Deployment (CI/CD)
  • Setting up CI/CD pipelines for Yii applications.
  • Integrating with tools like Jenkins, GitHub Actions, or GitLab CI.
  • Automated testing and deployment workflows.
  • Deployment Strategies
  • Preparing your application for production.
  • Configuring environments (production, staging, development).
  • Deployment tools and techniques (SSH, FTP, Git-based deployments).
  • Zero-downtime deployments and rollbacks.
  • Version Control with Git
  • Managing Yii projects with Git.
  • Branching and merging strategies (GitFlow).
  • Handling conflicts and pull requests.
  • Advanced Yii Features
  • Internationalization (i18n) and localization (l10n).
  • Event-driven programming and behaviors.
  • Dependency injection and service locator.
  • Using Yii's console application for background tasks.
  • Best Practices and Design Patterns
  • Adhering to coding standards (PSR-12).
  • Utilizing design patterns effectively in Yii (Singleton, Factory, Observer).
  • Writing clean, maintainable, and scalable code.
  • Documentation and code commenting best practices.
  • Hands-On Final Project:
  • Deploy the blog application to a live server (e.g., AWS, DigitalOcean, Heroku).
  • Implement final features such as user profiles, search functionality, and notifications.
  • Ensure the application adheres to best practices for security, performance, and scalability.
  • Perform comprehensive testing and debugging before deployment.

Programme scope, delivery arrangements and suitability are confirmed during enquiry.