Download the PHP package softadastra/ivi without Composer
On this page you can find all versions of the php package softadastra/ivi. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download softadastra/ivi
More information about softadastra/ivi
Files in softadastra/ivi
Package ivi
Short Description The official application skeleton for building modular web and console applications with IviPHP.
License MIT
Informations about the package ivi
Ivi
The official application skeleton for building modular web and console applications with IviPHP.
iviphp/ivi provides a minimal project structure powered by iviphp/framework. It includes application bootstrapping, configuration, service providers, console commands and writable storage directories without imposing a large application architecture.
Requirements
- PHP 8.2 or later
- Composer
- Required PHP extensions for the database driver used by the application
Installation
Create a new IviPHP application:
Enter the project directory:
Create the local environment file:
Make the console executable:
Display the available commands:
or:
Project structure
Application bootstrap
The application is created in:
This file:
- loads Composer;
- reads the local
.envfile; - loads application configuration;
- creates the framework instance;
- registers application service providers;
- registers console commands;
- returns the configured framework.
Example:
The bootstrap file may be reused by console and web entry points.
Environment configuration
Create .env from the example file:
Default values:
The .env file is ignored by Git and should contain machine-specific or private configuration.
Do not commit production credentials.
Application configuration
Application configuration is stored in:
Available settings include:
Retrieve configuration through the framework:
Check the current environment:
Check several environments:
Database configuration
Database configuration is stored in:
The default driver is SQLite:
Create the SQLite database file:
MySQL
PostgreSQL
The selected database package or provider is responsible for consuming this configuration and establishing connections.
Service providers
Application services are registered through service providers.
The default provider is:
It registers application metadata and common paths in the service container.
Available services include:
Resolve a service:
Check whether a service exists:
Creating a service provider
Create a provider in:
Example:
Register it in bootstrap/app.php:
Register several providers:
Provider lifecycle
Service providers have two lifecycle stages.
Registration
Registration happens when the provider is added to the framework.
Use this stage for:
- service instances;
- factories;
- aliases;
- configuration defaults;
- dependency bindings.
Booting
Booting happens after application bootstrap completes.
Use this stage for:
- resolving services;
- initializing components;
- registering listeners;
- preparing directories;
- connecting framework modules.
Console commands
Console commands are stored in:
The default application contains:
Run it with:
or through its alias:
Example output:
Creating a command
Create a command class:
Register it in bootstrap/app.php:
Run it:
Closure-backed commands
Commands may also be registered directly:
Run it:
or:
Console help
Display all commands:
or:
Display help for one command:
Command help is also available with:
Display the application version:
Console entry point
The executable console file is:
It:
- loads the application bootstrap;
- validates the returned framework instance;
- starts the framework;
- executes the requested command;
- returns the command exit code;
- displays startup failures safely.
Run it through PHP:
Make it directly executable:
Then run:
Debug mode
Enable debug mode in .env:
When console startup fails, debug mode displays:
- exception class;
- source file;
- source line;
- stack trace.
Disable it in production:
Storage directories
Writable application files are stored in:
The default directories are:
They are automatically created by Composer and by the default application service provider.
Create them manually when necessary:
The contents of these directories are ignored by Git.
Resolving application paths
The framework safely resolves paths relative to the project root.
Absolute paths and parent-directory traversal are rejected.
Accessing framework services
Retrieve the application:
Retrieve the service container:
Retrieve configuration:
Retrieve the console:
Retrieve the framework manager:
Application startup
Start the application manually:
This performs:
The lifecycle is idempotent. Completed stages are not executed again.
Bootstrap without booting providers:
Boot registered providers:
Check the lifecycle state:
Custom bootstrap operations
Register application initialization logic:
Bootstrap operations execute in registration order.
Development server
Once the public HTTP entry point is configured, start PHP's built-in development server:
Open:
The built-in PHP server is intended for local development only.
Composer commands
Install dependencies:
Update dependencies:
Refresh autoload files:
Validate the project configuration:
Production preparation
Before deploying:
Use production environment settings:
Ensure the storage directories are writable by the application process:
Deployment permissions should be adapted to the server and user configuration.
Extending the application
Application code belongs under:
Recommended namespaces:
Composer maps the App namespace to src:
After adding or moving classes, regenerate Composer autoload files:
Design principles
The Ivi application skeleton follows these principles:
- minimal initial structure;
- modular framework packages;
- explicit application bootstrapping;
- service-provider based composition;
- dependency-container integration;
- console-first developer tooling;
- environment-based configuration;
- replaceable application services;
- predictable application lifecycle;
- no unnecessary application abstractions.
License
Ivi is open-source software released under the MIT License.
Maintainer
Maintained by Gaspard Kirira and Softadastra.