PHP basics for Pionia

Who this is for

You want to build a Pionia API but have not written much PHP yet. You do not need to master the language — just enough to read service classes and run commands in a terminal.

What you will learn

  • How Pionia projects are laid out with Composer
  • What namespaces mean in Application\Services\TaskService
  • How to read a stack trace when something breaks

Before you start

Before you start
  • PHP 8.5+ installed (php -v)
  • Composer installed (composer -V)
  • A text editor (VS Code, Cursor, PhpStorm)

Namespaces and autoloading

Pionia apps use the Application\ namespace for your code:

namespace Application\Services;

class TaskService extends \Pionia\Http\Services\Service
{
    // ...
}

Composer maps Application\ → the services/ folder via autoload rules in composer.json. You rarely edit autoload by hand — make:service scaffolds files in the right place.

Reading an error

When DeskFlow fails, check storage/logs/ or run with DEBUG=true in .env. A typical error shows:

ValidationException: The title field is required.
  at TaskService.php:42

The file and line tell you where to look; the message tells you what to fix.

Common mistakes

  • Running commands from the wrong directory — always cd deskflow-api first
  • Missing PHP extension (e.g. pdo_sqlite) — install via your OS package manager
  • Typo in namespace after renaming a class — run composer dump-autoload

What’s next

Continue to Introduction and scaffold DeskFlow with Composer.