PHPackages                             vgalvoso/phpeasy - 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. vgalvoso/phpeasy

ActiveLibrary[Framework](/categories/framework)

vgalvoso/phpeasy
================

PHPEasy an API-centric PHP framework

v1.3(2y ago)342MITPHP

Since Oct 9Pushed 2y ago1 watchersCompare

[ Source](https://github.com/vgalvoso/phpeasy)[ Packagist](https://packagist.org/packages/vgalvoso/phpeasy)[ RSS](/packages/vgalvoso-phpeasy/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)DependenciesVersions (14)Used By (0)

Welcome to PHPEasy
==================

[](#welcome-to-phpeasy)

PHPEasy is an API-centric PHP framework. Code as close to PHP language itself rather than a framework.

Features
--------

[](#features)

1. REST API development
2. Full-stack web app development
3. File-based routing
4. Lightweight, no too much dependencies and configurations
5. Simple Database Abstraction Layer
6. Helper Functions such as input validator, code generator, upload file, etc.
7. Promotes ubt not limitted to procedural programming
8. Supports PHP 8 and above , MySQL, MSSQL and SQlite
9. Includes basic css(mystyle.css) and js(vanscript.js) utility library.

Main Points
-----------

[](#main-points)

1. Promotes to master the PHP language itself rather than a framework.
2. Direct to the point coding, no too much abstractions.
3. Use of Data Abstraction Layer rather than ORM, focused on maximum performance without large database calls used by orms.

Table of Contents
-----------------

[](#table-of-contents)

I. [Intro](#intro)

II. [Pre-requisites](#pre-requisites)

III. [Installation](#installation)

1. [Views](#1-views)
2. [APIs](#2-apis)
3. [API Functions](#3-api-functions)
4. [Working with Database](#4-working-with-database)
5. [Progressive](#5-progressive)
6. [Extra](#6-extras)

Intro
-----

[](#intro)

This is for someone who loves Vanilla PHP and its simplicity. Nowadays you must follow coding standards(OOP,SOLID,DRY,etc.) and mvc frameworks to do web development using PHP. PHP frameworks out there comes with too much files, configurations, classes and dependencies. I made this mini framework so php developers can do web development faster while mastering and enjoying the PHP language itself (Yes! no need to learn so many libraries).

Pre-requisites
--------------

[](#pre-requisites)

1. PHP 8^.
2. Composer.

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

[](#installation)

Composer - open a terminal inside your root or htdocs folder and execute the command below.

```
composer create-project vgalvoso/phpeasy my_phpeasy

```

you can change \[my\_phpeasy\] to any project name you want.

Now open your browser and go to [http://localhost/my\_phpeasy](http://localhost/my_phpeasy)

1. Views
--------

[](#1-views)

Create views inside View folder.

View routes will be automatically created based on View folder structure.

Look at examples below.

1. View file path: \[View/admin/dashboard.php\], the route: \["admin/dashboard"\].
2. View file path: \[View/login.php\], the route: \["login"\].

You can ommit the file name if the view file is named \[index.php\]:

1. View file path: \[View/index.php\], the route: \[""\].
2. View file path: \[VIew/admin/index.php\], the route: \["admin"\].

1.1 View components
-------------------

[](#11-view-components)

(SPA)Single Page Applications are composed of view components.

View components are accessible only through ajax requests.

Just call Core/Helper/component(); at the top of view file to specify it as a view component.

Example: View/admin/users\_table.php

```

            Username
            First Name
            Last Name

        No Contents

```

2. APIs
-------

[](#2-apis)

PHPEasy supports REST API.

All APIs are placed inside api folder.

API routes will automaticaly created through api folder file structure and implemented functions inside the php file named with http verbs e.g.(get(),post(),patch()).

So for example you omitted the delete() function, you can't call DELETE api/users/{id}.

Here is an example of a Users REST API.

API file path: \[api/users.php\]

Routes:

1. GET api/users - Get all users
2. GET api/users/{id} - Get user by id
3. POST api/users - Create new user
4. DELETE api/users/{id} - Delete a user
5. PUT api/users/{id} - Replace user
6. PATCH api/users/{id} - Update a user

```
