PHPackages                             jarscr/teo - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. jarscr/teo

ActiveProject[Framework](/categories/framework)

jarscr/teo
==========

TEO Simple PHP Framework for building web applications in PHP

1.0.8(4w ago)533MITPHPPHP ^8.3

Since Dec 29Pushed 4w agoCompare

[ Source](https://github.com/jarscr/teo)[ Packagist](https://packagist.org/packages/jarscr/teo)[ Docs](https://github.com/jarscr/teo)[ RSS](/packages/jarscr-teo/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (14)Versions (8)Used By (0)

[![](https://raw.githubusercontent.com/jarscr/teo/master/public/static/img/logos/logo-teo.png)](https://jarscr.com)

[![PHP Version](https://camo.githubusercontent.com/935879ba0fbf6809e03e18971661f51dc9d9bd211adb7b89a70bed6fd7793492/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d5e382e332d627269676874677265656e2e737667)](https://packagist.org/packages/jarscr/teo)[![Total Downloads](https://camo.githubusercontent.com/6ed2e1062388d217a72611557a1f363ca2555e20cf1000db31b5d76787db9018/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a61727363722f74656f)](https://packagist.org/packages/jarscr/teo)[![Latest Stable Version](https://camo.githubusercontent.com/651f26a8a06989f15793abe47f2bf47e91c8e57998bb427bff5328b2d3466975/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a61727363722f74656f)](https://packagist.org/packages/jarscr/teo)[![Build Status](https://camo.githubusercontent.com/5e15e433b4f41f3cb37891a0d8dcd1e9fc8a002decd1cefdfa00936397ede301/68747470733a2f2f6170692e7472617669732d63692e636f6d2f6a61727363722f74656f2e737667)](https://packagist.org/packages/jarscr/teo)[![License](https://camo.githubusercontent.com/6f3284805f91be2ad0d4372df638eb40a73c30ea64b1e5b1edcc2a9b29b1da0a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6a61727363722f74656f)](https://packagist.org/packages/jarscr/teo)

Acerca de TEO Simple PHP Framework
==================================

[](#acerca-de-teo-simple-php-framework)

TEO es un framework PHP para construir aplicaciones y sitios web. Es gratis y [open-source](LICENSE).

Basado en MVC ([daveh/php-mvc](https://github.com/daveh/php-mvc)).

**Requisitos:** PHP **8.3** o **8.4**, Composer, MySQL/MariaDB (opcional según tu app).

Iniciar usando el framework
---------------------------

[](#iniciar-usando-el-framework)

1. Instala el proyecto: `composer create-project jarscr/teo app-ejemplo`
2. Entra al directorio e instala dependencias si hace falta: `composer install`
3. Copia la configuración de entorno:

    ```
    cp .env.example .env
    ```
4. Edita `.env` con tus datos de base de datos e idioma.
5. Importa el esquema si lo necesitas: `mysql -u root -p < teo.sql`
6. Configura el servidor web para que el **document root** sea la carpeta `public/`.
7. Crea rutas, controladores, vistas y modelos.

> **Importante:** no subas el archivo `.env` a Git. Contiene secretos (credenciales, flags de depuración).

Configuración
-------------

[](#configuración)

La configuración se carga desde variables de entorno (archivo [`.env`](.env.example) o el entorno del servidor). La clase [App/Config.php](App/Config.php) las lee de forma segura.

Variables principales:

VariableDescripciónEjemplo`APP_ENV`Entorno (`local`, `production`, …)`local``APP_DEBUG`Mostrar errores detallados (`true` / `false`)`false``APP_LANG`Idioma por defecto`es``APP_VERSION`Versión de la aplicación`1.0.8``DB_HOST`Host de MySQL`127.0.0.1``DB_NAME`Nombre de la base de datos`teo``DB_USER`Usuario`teo``DB_PASSWORD`Contraseña`change-me``DB_CHARSET`Charset PDO`utf8mb4`Uso en código:

```
use App\Config;

$host = Config::dbHost();
$debug = Config::showErrors();
$lang = Config::lang();
```

En producción deja `APP_DEBUG=false`. Los errores se registran en `logs/` y se muestran plantillas genéricas 404/500.

Rutas
-----

[](#rutas)

Las [rutas](Core/Router.php) traducen URLs en controladores y acciones. Se definen en el [front controller](public/index.php).

```
$router->add('', ['controller' => 'Home', 'action' => 'index']);
$router->add('posts/index', ['controller' => 'Posts', 'action' => 'index']);
$router->add('{controller}/{action}');
$router->add('{controller}/{id:\d+}/{action}');
$router->add('admin/{controller}/{action}', ['namespace' => 'Admin']);
```

El router valida nombres de controlador/acción/namespace y solo permite invocar métodos `*Action` a través de los filtros del controlador (no se pueden llamar métodos arbitrarios).

Controladores
-------------

[](#controladores)

Los controladores viven en `App/Controllers`, extienden [Core\\Controller](Core/Controller.php) y usan el namespace `App\Controllers`.

Las acciones llevan el sufijo `Action` (por ejemplo `indexAction`). Los parámetros de ruta están en `$this->route_params`.

### Filtros before / after

[](#filtros-before--after)

```
protected function before(): mixed
{
    // return false para cancelar la acción
    return null;
}

protected function after(): void
{
}
```

Vistas
------

[](#vistas)

Las vistas están en `App/Views`. Dos formatos:

**PHP:**

```
View::render('Home/index.php', [
    'name' => 'Dave',
    'colours' => ['red', 'green', 'blue'],
]);
```

**Twig** (recomendado; autoescape HTML activo):

```
View::renderTemplate('Home/index.html', [
    'name' => 'Dave',
    'colours' => ['red', 'green', 'blue'],
], 'es');
```

Traducciones vía Symfony Translation + Twig Bridge; archivos en `App/Languages/` (`es.php`, `en.php`).

Plantilla de ejemplo: [App/Views/Home/index.html](App/Views/Home/index.html) (hereda de [base.html](App/Views/base.html)).

Las rutas de vista/plantilla rechazan path traversal (`..`).

Modelos
-------

[](#modelos)

Los modelos extienden [Core\\Model](Core/Model.php) y usan PDO con:

- charset `utf8mb4`
- `PDO::ERRMODE_EXCEPTION`
- `PDO::ATTR_EMULATE_PREPARES = false`
- fetch asociativo por defecto

```
$db = static::getDB();
$stmt = $db->prepare('SELECT id, username FROM users WHERE id = ?');
$stmt->execute([$id]);
$user = $stmt->fetch();
```

Ejemplo: [App/Models/User.php](App/Models/User.php). El esquema (tablas de `delight-im/auth`) está en [teo.sql](teo.sql) con motor **InnoDB**.

Errores
-------

[](#errores)

Con `APP_DEBUG=true` se muestran detalles escapados en el navegador. Con `false`, se escribe en `logs/YYYY-MM-DD.txt` y se renderizan [404.html](App/Views/404.html) / [500.html](App/Views/500.html).

Opcionalmente puedes integrar [Sentry](https://sentry.io) (`sentry/sentry` en `require-dev`).

Seguridad (resumen)
-------------------

[](#seguridad-resumen)

- Credenciales solo en `.env` / entorno del servidor
- Cabeceras HTTP básicas (`X-Content-Type-Options`, `X-Frame-Options`, CSP, etc.)
- Bloqueo de acceso a `.env`, `App/`, `Core/`, `vendor/`, `logs/` desde Apache (`.htaccess`)
- Acciones del router acotadas a `*Action` + filtros
- Twig con autoescape; salida de errores sanitizada

Pruebas
-------

[](#pruebas)

```
composer test
# o
vendor/bin/phpunit --configuration phpunit.xml.dist
```

Configuración del servidor web
------------------------------

[](#configuración-del-servidor-web)

- **Apache:** [public/.htaccess](public/.htaccess) (y [.htaccess](.htaccess) en la raíz si el vhost apunta al proyecto)
- **nginx:** [nginx-configuration.txt](nginx-configuration.txt) — el root debe ser `public/`

---

Licencia
--------

[](#licencia)

Teo PHP MVC es software open-source bajo [licencia MIT](https://opensource.org/licenses/MIT).

Desarrolla
----------

[](#desarrolla)

[![](https://raw.githubusercontent.com/jarscr/teo/master/public/static/img/logos/logo-jarscr.png)](https://jarscr.com)

###  Health Score

51

—

FairBetter than 95% of packages

Maintenance94

Actively maintained with recent releases

Popularity14

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity74

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~338 days

Recently: every ~507 days

Total

7

Last Release

28d ago

PHP version history (3 changes)1.0.0PHP ~7.3

1.0.7PHP ~8.1

1.0.8PHP ^8.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3277029?v=4)[Alfredo Rodriguez Siles](/maintainers/jarscr)[@jarscr](https://github.com/jarscr)

---

Top Contributors

[![jarscr](https://avatars.githubusercontent.com/u/3277029?v=4)](https://github.com/jarscr "jarscr (49 commits)")

---

Tags

phpframeworkwebmvcCosta Ricajarscrteo

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jarscr-teo/health.svg)

```
[![Health](https://phpackages.com/badges/jarscr-teo/health.svg)](https://phpackages.com/packages/jarscr-teo)
```

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k18.3M427](/packages/easycorp-easyadmin-bundle)[shopware/platform

The Shopware e-commerce core

3.4k1.5M3](/packages/shopware-platform)[pimcore/pimcore

Content &amp; Product Management Framework (CMS/PIM/E-Commerce)

3.8k3.9M535](/packages/pimcore-pimcore)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.8M672](/packages/shopware-core)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.4M235](/packages/sulu-sulu)[contao/core-bundle

Contao Open Source CMS

1301.7M3.1k](/packages/contao-core-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
