PHPackages                             elielelie/leafy-core - 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. [Database &amp; ORM](/categories/database)
4. /
5. elielelie/leafy-core

ActiveLibrary[Database &amp; ORM](/categories/database)

elielelie/leafy-core
====================

The Minimalistic custom framework created with Eloquent ORM.

1.2.4(7mo ago)158MITPHPPHP ^8.0

Since May 12Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/eliel-elie/leafy-core)[ Packagist](https://packagist.org/packages/elielelie/leafy-core)[ RSS](/packages/elielelie-leafy-core/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (7)Versions (26)Used By (0)

Leafy Core
==========

[](#leafy-core)

[![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](https://opensource.org/licenses/MIT)

Leafy Core is a minimalistic and flexible PHP micro-framework designed for building web applications and APIs quickly. It leverages the powerful Eloquent ORM from Laravel for database interactions and provides a simple but effective routing system, a straightforward view layer, and a command-line interface for common tasks.

Features
--------

[](#features)

- **Simple &amp; Fast Routing**: A clean and easy-to-use router supporting parameters and controller bindings.
- **Eloquent ORM Integration**: Harness the full power of Laravel's Eloquent for database operations, including relationships, migrations, and seeding. It comes with `yajra/laravel-oci8` for Oracle DB support.
- **View Layer**: A simple template system that uses plain PHP files for views and layouts.
- **Middleware Support**: Protect your routes and manage requests with middleware.
- **CLI Commands**: Includes a console command runner for database migrations, key generation, and more.
- **Centralized Configuration**: Easy environment-based configuration using `.env` files.
- **Error Handling**: Pre-configured to capture and log all uncaught exceptions and errors.

Installation
------------

[](#installation)

You can install Leafy Core via Composer.

```
composer require elielelie/leafy-core
```

Configuration
-------------

[](#configuration)

### Environment File

[](#environment-file)

Configuration is handled through an `.env` file in the root of your project. To get started, copy the `.env.example` file to `.env`.

```
cp .env.example .env
```

Then, update the variables in your new `.env` file to match your environment. A unique `APP_KEY` can be generated using the CLI command.

```
php console key:generate
```

### Key Environment Variables

[](#key-environment-variables)

- `APP_NAME`: The name of your application.
- `APP_KEY`: A unique, 32-character random string for encryption.
- `APP_URL`: The base URL of your application.
- `APP_FOLDER`: If your app is in a subfolder, specify it here (e.g., `/myapp`).
- `APP_DEBUG`: Set to `true` for development, `false` for production.
- `DB_DRIVER`: Database driver (e.g., `mysql`, `pgsql`, `oracle`).
- `DB_HOST`, `DB_PORT`, `DB_DATABASE`, `DB_USERNAME`, `DB_PASSWORD`: Database credentials.

Application Structure
---------------------

[](#application-structure)

Leafy Core is a library, but it's designed to be used within a project structure like this:

```
.
├── app/
│   ├── Controllers/
│   ├── Middlewares/
│   └── Models/
├── config/
├── public/
│   └── index.php
├── resources/
│   ├── views/
│   └── lang/
├── routes/
│   └── web.php
├── storage/
├── .env
└── composer.json

```

### Bootstrap

[](#bootstrap)

Your application's entry point is typically `public/index.php`. Here you will bootstrap the Leafy Core application.

```
