Download the PHP package giovanni-venturelli/sophia without Composer

On this page you can find all versions of the php package giovanni-venturelli/sophia. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package sophia

Sophia Framework — Lightweight PHP Components, DI, and Router

Minimal, production‑oriented PHP framework with:

Components are plain PHP classes (annotated), services are auto‑wired, routes map to components (views) or callbacks (APIs).

Quick navigation

What you get (features)

Architecture at a glance

Flow for a component route: 1) Router matches the incoming path → selects a component class 2) ComponentRegistry lazily registers it and Renderer creates a ComponentProxy 3) ComponentProxy opens a DI scope, warms providers, creates the component, runs property injection, then onInit() 4) Renderer collects public properties/zero‑arg getters and renders the PHP template

Installation

A .env file in the project root is loaded automatically when present.

Project structure

A typical application:

Quick start (index.php + routes.php)

Bootstrap in index.php:

Everything else is wired automatically: .env, debug mode (DEBUG in the environment), the database (see Database integration), the router, the renderer, the build cache in production, error pages and debug metrics.

All options, with their defaults:

Option Default Meaning
basePath '' URL prefix of the app; also used for the <base> tag and asset URLs
debug DEBUG env Profiler, metrics and detailed errors; disables the build cache
language 'en' <html lang>
routes 'routes.php' Routes file
components [] Directories whose #[Component] classes are registered up front (otherwise components are registered lazily)
services [] Directories scanned by sophia build for root services
templates [] Fallback template directories
styles [] Global stylesheets
scripts [] Global scripts
favicon null Favicon path
database null Database config array or file; null auto-detects

Options can also live in composer.json under extra.sophia; values passed to create() win. Settings that the build tool needs (components, routes, services) belong there, so that sophia build sees the same values as the app:

Define routes in routes.php by returning an array:

Calling Router::getInstance()->configure([...]) inside the file still works.

Upgrading from the manual bootstrap

The old wiring (setRegistry, setRenderer, setComponentRegistry, setControllerRegistry, configure) still works, but none of it is required anymore. Two behaviours changed:

Create your first component

Component class under pages/... and a PHP template next to it:

Template home.php:

The renderer passes route params (:id) as initial data to the root component.

Dependency Injection (services)

Example service + usage in a component:

See the full DI reference: Injector (DI).

Routing basics (components, params, urls)

Template helpers:

More details: Router.

Redirections and Guards

(Existing content for Routing basics...)

Performance & Build System

Sophia includes a build system to optimize performance in production (up to 40% faster).

How it works

In development mode (DEBUG=true), the framework scans folders and uses the Reflection API on every request. In production (DEBUG=false), the framework loads pre-generated static maps.

CLI Commands

From the project root:

When installed as a dependency the command is vendor/bin/sophia build. Routes that contain closures cannot be compiled: in that case the build says so and the routes file keeps being loaded at runtime.

When to run the build?

The build is only necessary when the structure of the application changes:

Note: It is not necessary to rebuild if you only modify the database content, the logic code inside a method, or the HTML markup of an existing template.

Database integration (optional)

The ConnectionService is a root‑provided service with a fluent QueryBuilder and an Active Record‑style ORM via Entity.

Example entity:

Query examples:

Full guide: Database.

Troubleshooting

Deep dives (module READMEs)


Using this repository as a package + demo

This repo is organized so that only the framework is published to Packagist, while the demo app stays in-repo only.

Run the demo locally from this repo

With XAMPP (or any Apache with mod_rewrite) the demo is served at http://localhost/sophia/demo/ through demo/.htaccess. If you serve it at a different path, update basePath in demo/index.php and RewriteBase in demo/.htaccess. It needs pdo_sqlite: the database file demo/database/demo.sqlite is created and seeded on first visit.

Section Shows
Components inputs and aliases, getters, onInit(), scoped CSS/JS
Slots Angular-style content projection: default and named slots, fallback, nesting, slots with a context
Injection root singletons, component providers, constructor injection
Routing parameters, named routes, layouts with outlet, route groups, guards, redirects, ** 404 page, callbacks
Forms #[FormHandler], CSRF, validation errors, old input, flash messages
Database QueryBuilder and Entity CRUD on SQLite
API REST controller with #[Get], #[Post], #[Patch], #[Delete] and an in-page client
Internals build cache, registered components, request facts

To try the production build:

Publishing to Packagist

1) Push this repository to GitHub under giovanni-venturelli/sophia. 2) Create a version tag, e.g.:

3) Submit the repository URL to Packagist and set up the GitHub Service Hook so Packagist auto-updates on new tags.

After publish, consumers can composer require giovanni-venturelli/sophia.

Forms — end-to-end example

Route (already present in routes.php):

Template:

The $form_action('send') helper generates a URL like /sophia/forms/submit/<token>. Make sure basePath is set in index.php.

Named routes — quick tip

Always add name to routes you want to link to from templates:

Then in templates:


All versions of sophia with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
ext-pdo Version *
ext-pdo_mysql Version *
ext-pdo_sqlite Version *
vlucas/phpdotenv Version ^5.6
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package giovanni-venturelli/sophia contains the following files

Loading the files please wait ...