Web Development · WDC-68

PHP OOP and CodeIgniter Framework

PHP OOP and CodeIgniter Framework is a course in object-oriented PHP 8.5, connecting to MySQL, MariaDB and SQL Server through PDO, then using CodeIgniter 4.7 to build web applications and REST APIs secured with Shield. It suits developers who already write PHP and teams maintaining older CodeIgniter systems who want a clear, modern structure.

Updated
From 5,850 THB / person 6,500 −10% excl. VAT 7% · group rates available
PDFDownload the course outline
  • Duration12 hours · 2 days
  • FormatOnsite / live online
  • Next roundOn request
  • CertificateIncluded

Course overview

Most PHP work in organisations does not start from scratch. Teams extend existing systems, connect to several kinds of database and expose APIs for other systems to call. Object-oriented code splits a system into parts with clear responsibilities, and CodeIgniter is a lightweight framework that is quick to learn and easy to install on ordinary hosting, so it suits teams that want a tidy MVC structure without the complexity of a larger framework.

This course starts with the object-oriented PHP 8.5 you need to use a framework well, including classes, interfaces, traits, enums and exceptions, then connects to MySQL, MariaDB and Microsoft SQL Server through PDO. Learners then use CodeIgniter 4.7 to build a web application and REST API covering routing, controllers, models, entities, migrations and validation, secure the API with Shield and call external services. The course closes with a product management workshop including tests and deployment. (2 days, 6 hours per day, 12 hours in total, Intermediate level.)

What you’ll gain

  • Understand the object-oriented PHP 8.5 that frameworks rely on, such as classes, interfaces, traits, namespaces and enums
  • Connect safely to MySQL, MariaDB and Microsoft SQL Server with object-oriented PDO
  • Install and structure a CodeIgniter 4.7 project with Composer
  • Use CodeIgniter routing, controllers, views, models, entities, migrations and validation
  • Build a REST API that returns JSON with correct HTTP status codes and pagination
  • Protect an API with Shield access tokens and call third-party services
  • Write tests and deploy a CodeIgniter application to production

Who this course is for

  • Developers who already write PHP and want to move to object-oriented code with a framework
  • Teams maintaining older CodeIgniter systems who want to move to CodeIgniter 4
  • Developers who must connect PHP to both SQL Server and MySQL in the same organisation
  • IT managers choosing a framework approach for their development team
  • Anyone interested who has some PHP and database experience

Prerequisites

  • Able to write PHP, including variables, conditions, loops, arrays and functions
  • Able to write basic SQL, with some experience of MySQL or SQL Server
  • Basic knowledge of HTML and how websites work
  • A laptop that can run Docker Desktop or PHP 8.4 or later, Composer and VS Code, with permission to install software

Curriculum

Course Details

This course is the 2026 edition of PHP OOP and CodeIgniter Framework. It runs for 2 days, 6 hours per day (12 hours in total, 09:00-16:00), as lectures with labs and a workshop. Intermediate level. This edition uses PHP 8.5 and CodeIgniter 4.7, drops the PHP ActiveRecord library, which is no longer maintained, in favour of CodeIgniter models and entities, and adds migrations, Shield, API pagination and

transformers, feature tests and deployment. It still connects to MySQL, MariaDB and Microsoft SQL Server through PDO. The course teaches the object-oriented PHP you need for a framework, unlike PHP OOP and MySQL, which goes deep into SOLID and design patterns. Every lab runs on the learner's own machine with Docker and open source tools. Learners take home a lab guide, source code for every lab and their workshop project.

Day 1 Object-Oriented PHP 8.5 and Database Access

Section 1: Lab: Setting Up Tools and a PHP 8.5 Project

  • Install VS Code with extensions for PHP and Git
  • Run PHP 8.5, MySQL and SQL Server with Docker Compose
  • Manage packages with Composer and PSR-4 autoloading
  • Lab: a starter project used throughout day one

Section 2: Classes, Objects and Encapsulation

  • Why OOP, and how it differs from top-down code
  • Classes, objects, typed properties and methods
  • Constructor promotion, readonly and visibility
  • Lab: a product class that validates its values on creation

Section 3: Lab: Inheritance, Interfaces and Traits

  • Inheritance, overriding and final
  • Abstract classes versus interfaces, and polymorphism
  • Traits, static methods and using them in moderation
  • Lab: a shipping cost calculator with several methods behind an interface

Section 4: Namespaces, Enums and Exceptions

  • Organising code with namespaces and use, the way frameworks do
  • Backed enums for data statuses
  • Custom exceptions and systematic error handling
  • Lab: order statuses with enums and exceptions

Section 5: Lab: PDO with MySQL and MariaDB

  • A PDO connection class with utf8mb4 and exception error mode
  • Prepared statements to prevent SQL injection
  • CRUD and transactions with beginTransaction and rollBack
  • The repository idea, and Active Record versus Data Mapper ORMs

Section 6: Lab: PDO with Microsoft SQL Server

  • Install the Microsoft Drivers for PHP and the ODBC driver
  • The sqlsrv DSN and SQL differences such as TOP and OFFSET FETCH
  • One interface to switch between MySQL and SQL Server
  • Lab: product CRUD on SQL Server with the same classes
Day 2 CodeIgniter 4.7 and REST APIs

Section 7: Lab: Getting Started with CodeIgniter 4.7

  • An overview of CodeIgniter 4 and how it differs from CodeIgniter 3
  • Install with Composer, and the app, public and writable folders
  • Configure with the .env file and use the spark command
  • Defined routes versus improved auto routing

Section 8: Controllers, Views and Validation

  • Controllers, requests and responses
  • View layouts and escaping output with esc()
  • Forms with validation rules, and CSRF protection through a filter
  • Lab: forms to add and edit products

Section 9: Lab: Models, Entities and Migrations

  • Create tables with migrations and sample data with seeders
  • Models with allowedFields, validation and soft deletes
  • Entities for mapping data to objects, and the query builder
  • Database groups for MySQL and SQL Server in one project

Section 10: Lab: REST APIs with ResourceController

  • Define routes with $routes->resource and route groups
  • ResourceController and ResponseTrait to return JSON with HTTP status codes
  • Paginate with paginate() and shape data with API transformers
  • Configure CORS and test every endpoint in Postman

Section 11: Security and Third-Party Services

  • Install Shield and build a login system
  • Protect the API with access tokens and the tokens filter
  • Limit request rates with the Throttler
  • Lab: call a third-party API with CURLRequest

Section 12: Workshop: Product Management System with an API

  • Product management pages and an API for other apps to call
  • Feature tests with PHPUnit
  • Deploy with public as the document root and the production environment
  • Use an AI assistant to review code with care, and next steps

Schedule & training options

For individuals — public rounds

No public rounds are open right now. Join the waiting list and we will contact you first when the next round opens, or ask us on LINE. Or call 02-570-8449 or 088-807-9770

For organisations — in-house / private

  • Tailor the content to your team’s tools and projects
  • Your dates, at your office or live online
  • Quotation with tax ID for procurement
Corporate training quote

Instructors

Frequently asked questions

What is the difference between an abstract class and an interface in PHP?

An abstract class is a parent class that cannot be instantiated. It can hold implemented methods, properties and abstract methods that child classes must complete, and a class can extend only one. An interface only declares the methods a class must provide, and a class can implement several. Frameworks such as CodeIgniter use interfaces to define contracts between components, which makes them easy to swap and test.

What is PDO in PHP, and can it be used with SQL Server?

PDO (PHP Data Objects) is an object-oriented database layer that works the same way across databases such as MySQL, MariaDB and SQL Server; you change only the DSN and driver. For SQL Server you first install the Microsoft Drivers for PHP for SQL Server and the ODBC driver. Its key benefit is prepared statements, which keep SQL separate from user input and prevent SQL injection.

What are the steps to build a REST API with CodeIgniter 4?

Install CodeIgniter 4 with Composer, configure the database in the .env file, create tables with migrations and add a model. Then create a controller that extends ResourceController, which provides the standard index, show, create, update and delete methods. Register the routes with $routes->resource, use ResponseTrait to return JSON with correct HTTP status codes, paginate with paginate(), protect the API with Shield access tokens and test every endpoint in Postman.

Can a CodeIgniter 3 system be moved straight to CodeIgniter 4?

Not directly, because CodeIgniter 4 is a complete rewrite. It uses namespaces, installs through Composer, separates the public folder from the code and changes how models, libraries and configuration work. The usual approach is to create a new CodeIgniter 4 project and move controllers, models and views across one part at a time following the upgrade guide, testing as you go. This course covers the OOP and CodeIgniter 4 structure you need for such a move.

Who is the PHP OOP and CodeIgniter Framework course for, and what should I know beforehand?

It suits developers who already write PHP and want to write object-oriented code with a framework, teams maintaining older CodeIgniter systems, developers who connect PHP to SQL Server and MySQL, and IT managers choosing an approach for their team. You should be able to write PHP with variables, conditions, loops, arrays and functions, write basic SQL and know some HTML.

Can the PHP OOP and CodeIgniter Framework course be run in-house for our team?

Yes. It can be run in-house for your team, with examples adapted to your work, such as using the database your organisation already runs or planning a move from CodeIgniter 3 to CodeIgniter 4. You can request a quotation from this page, or contact us on LINE @itgenius or by phone on 02-570-8449.

Related articles

Articles are published in Thai.