PHPackages                             alishahidi/apantos - 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. alishahidi/apantos

ActiveProject[Framework](/categories/framework)

alishahidi/apantos
==================

The Apantos Framework.

v1.4.4(3y ago)15152[2 issues](https://github.com/alishahidi/apantos/issues)MITPHPPHP &gt;=8.1.0

Since May 1Pushed 2y ago1 watchersCompare

[ Source](https://github.com/alishahidi/apantos)[ Packagist](https://packagist.org/packages/alishahidi/apantos)[ RSS](/packages/alishahidi-apantos/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (7)Dependencies (15)Versions (11)Used By (0)

Apantos doc - main
==================

[](#apantos-doc---main)

TABLE OF CONTENTS
=================

[](#table-of-contents)

- [What is apantos](#what-is-apantos)
- [How create first Apantos project](#how-create-first-apantos-project)
    - [Set tokens](#set-tokens)
- [What is framework architecture ?](#what-is-framework-architecture-)
- [Directory Structure](#directory-structure)
- [Directory explanation](#directory-explanation)
    - [app](#app)
    - [bootstrap](#bootstrap)
    - [public](#public)
    - [resources](#resources)
    - [routes](#routes)
    - [storage](#storage)
    - [system](#system)
- [Routing system](#routing-system)
    - [How create route](#how-create-route)
- [Controllers](#controllers)
- [Model](#model)
- [Orm](#orm)
    - [Example tables](#example-tables)
    - [create](#create)
    - [update](#update)
    - [delete](#delete)
    - [all](#all)
    - [find](#find)
    - [where](#where)
    - [whereOr](#whereor)
    - [whereNull](#wherenull)
    - [whereNotNull](#wherenotnull)
    - [whereIn](#wherein)
    - [whereBetween](#wherebetween)
    - [randomOrder](#randomorder)
    - [orderBy](#orderby)
    - [limit](#limit)
    - [count](#count)
    - [pagination](#pagination)
    - [Relationships](#relationships)
- [View](#view)
    - [apts template engine](#apts-template-engine)
    - [render](#render)
- [Auth system](#auth-system)
    - [registerUser](#registeruser)
    - [updateUser](#updateuser)
    - [loginUsingEmail](#loginusingemail)
    - [loginUsingUsername](#loginusingusername)
    - [loginUsingId](#loginusingid)
    - [logout](#logout)
    - [check](#check)
    - [checkLogin](#checklogin)
    - [user](#user)
    - [userUsingEmail](#userusingemail)
    - [userUsingUsername](#userusingusername)

What is apantos
===============

[](#what-is-apantos)

Apantos is a fast and simple framework based on php with security methods and dedicated orm. Modularly

How create first Apantos project
================================

[](#how-create-first-apantos-project)

This project available on composer packagist you can easily install by `composer create-project`

```
composer create-project alishahidi/apantos
```

for serve project on port **8000**

```
php -S 127.0.0.1:8000 -t public
```

Set tokens
----------

[](#set-tokens)

after create project you must set .env `CRYPT_TOKEN` &amp; `TOKEN` variable by default `/api/token` url set for get valid token using this url 2 time and save gived token into env variables

**recommended remove token api route after saving token from** `/routes/api`

What is framework architecture ?
================================

[](#what-is-framework-architecture-)

this framework use mvc architecture

models in **app/Models** views in **resources/view** controllers in **app/Controllers**

Directory Structure
===================

[](#directory-structure)

```
- app
  - Http
    - Controllers
    - Request
    - Services
  - Models
  - Providers
- bootstrap
  - /bootstrap.php/
- config
  - /app.php/
  - /database.php/
  - /image.php/
  - /mail.php/
- database
  - migrations
- public
  - /index.php/
- resources
  - view
- routes
  - /api.php/
  - /web.php/
- storage
  - fonts
  - images
- system

```

Directory explanation
=====================

[](#directory-explanation)

app
---

[](#app)

Important directory contain controllers and request and .... for manage routes handlers and check form input and more

### Http

[](#http)

Contain web request handlers and services

#### Controllers

[](#controllers)

Management classes for routes

standard name: `NameController.php`

#### Request

[](#request)

User input checkers

standard name: `NameRequest.php`

#### Services

[](#services)

Refactored classes

standard name: `Name.php`

### Models

[](#models)

Database Models

standard name `Name.php` **Use singular nouns**

### Providers

[](#providers)

Providers run each request if stored in config file

standard name: `NameProvider.php`

bootstrap
---------

[](#bootstrap)

contain `bootstrap.php` file

The job of this file is to load the framework

public
------

[](#public)

this direcotry serve as root directory

every request must be redirect to `index.php` file

resources
---------

[](#resources)

contain view direcotry

### view

[](#view)

contain views direcotry &amp; php file

standard name for use apts template engine: `view.apts.php` standard name for normal use without template engine: `view.php`

routes
------

[](#routes)

### web.php

[](#webphp)

for web request routes

### api.php

[](#apiphp)

for api request routes

storage
-------

[](#storage)

for in project files ex: files used for packages

system
------

[](#system)

kernel of framework

Routing system
==============

[](#routing-system)

all routes available in **routes/{web, api}.php** file

How create route
----------------

[](#how-create-route)

### Note

[](#note)

web route start from **/** api routes start from **/api**

### Argvs

[](#argvs)

1. url
2. Controller with namespace &amp; class function name after @
3. route name

### Get

[](#get)

```
Route::get('/', "Home\HomeController@index", 'home.index');
```

### Post

[](#post)

```
Route::post('/login', "Auth\LoginController@login", 'auth.login');
```

### Put

[](#put)

```
Route::put('/admin/article/update/{id}', "Admin\ArticleController@update", 'admin.article.update');
```

### Delete

[](#delete)

```
Route::delete('/admin/article/delete/{id}', "Admin\ArticleController@destroy",'admin.article.delete');
```

Controllers
===========

[](#controllers-1)

controllers called by routing system

controllers must be set in `Route` method

create your Controllers in **app/Http/Controller** like this

```
namespace App\Http\Controllers\Home;

use App\Http\Controllers\Controller;

class HomeController extends Controller
{
    public function index()
    {
        return "Hi";
    }
}
```

for use this example you must set Route for called index method in HomeController

```
Route::get('/', "Home\HomeController@index", 'home.index');
```

now if open **/** url in your browser you can see “Hi” message;

Model
=====

[](#model)

create your models in **app/Models** like this

```
namespace App\Models;

use System\Database\ORM\Model;
use System\Database\Traits\HasSoftDelete;

class User extends Model
{
    use HasSoftDelete;

    protected $table = 'users';

    protected $fillable = ['name', 'email', 'password', 'avatar', 'permissions', 'bio'];

    protected $casts = ['permission' => 'arrray']
}
```

use **Use singular nouns** for Model name and set full name of table in `protected $table`

you must set fillable table column in `protected $fillable` id, create\_at, updated\_at, deleted\_at exist by default in fillables

**casts** can convert arrays to safe string for stored in database and can convert string to array when you get record from database

Orm
===

[](#orm)

Example tables
--------------

[](#example-tables)

### users

[](#users)

 idusernamepasswordphone\_number 1alitest+11843019 2alextest+32095u023 3poptest+3925253### categories

[](#categories)

 idname 1linux 2emacs 3php### tags

[](#tags)

 idname 1linux 2emacs 3php 4json### posts

[](#posts)

 idtitlecat\_iddescription 1post number 11description of post number 1 2post 21description of post number 2 3post number 32description of post number 3 4post 43description of post number 4### post\_tag

[](#post_tag)

 idpost\_idtag\_1 111 212 321 423### comments

[](#comments)

 iduser\_idpost\_idcomment 112comment 1 222comment 2 311comment 3create
------

[](#create)

add record

### argvs

[](#argvs-1)

1. values:array

### use

[](#use)

```
$user = User::create([
    'username' => 'ali',
    'password' => 'test',
    'phone_number' => '+319021243'
]);

$insertId = $user->insertId;
```

or

```
$user = new User();
$user->username = 'ali';
$user->password = 'test';
$user->phone_number = '+30231234401';
$user->save();
```

update
------

[](#update)

update record

### argvs

[](#argvs-2)

1. values:array =&gt; with primary id

### use

[](#use-1)

```
$user = User::update([
    'id' => 1,
    'username' => 'alishahidi'
]);

// change ali username to alishahidi
```

or

```
$user = User::find(1);
$user->username = 'alishahidi';
$user->save();
```

delete
------

[](#delete-1)

delete record

### argvs

[](#argvs-3)

1. primary id

### use

[](#use-2)

```
User::delete(1);
```

all
---

[](#all)

give all records

### use

[](#use-3)

```
$users = User::all();
foreach($users as $user)
    echo $user->useranem;

// output

    // ali
    // alex
    // pop
```

find
----

[](#find)

give user where id = $id

### argvs

[](#argvs-4)

1. primary id

### use

[](#use-4)

```
$user = User::find(1);
$username = $user->username; // return ali
```

where
-----

[](#where)

add where condition in query

### argvs

[](#argvs-5)

if pass 2 argument it set operatino to =

1. attribute
2. value

if pass 3 argument it get operation from argument 2 and get value from argument 3

1. attribute
2. operatino
3. value

### use

[](#use-5)

```
// get first record
$post = Post::where('title', 'post number 1')->get()[0];
$title = $post->title; // return "post number 1"
```

or

```
// return all record contain "number" in title
$posts = Post::where('title', 'LIKE', "%number%")->get();
foreach($posts as $post)
    echo $post->title

// output

    // post number 1
    // post number 3
```

whereOr
-------

[](#whereor)

like `where` but with **OR** operation

whereNull
---------

[](#wherenull)

### argvs

[](#argvs-6)

1. attribute

### use

[](#use-6)

```
// get records if cat_id is null
$posts = Post::whereNull('cat_id')->get();
```

whereNotNull
------------

[](#wherenotnull)

### argvs

[](#argvs-7)

1. attribute

### use

[](#use-7)

```
// get records if cat_id is not null | is set
$posts = Post::whereNotNull('cat_id')->get();
```

whereIn
-------

[](#wherein)

### argvs

[](#argvs-8)

1. attribute
2. values:array

### use

[](#use-8)

```
// get posts recotds if cat_id in 1, 2, 3
$posts = Post::whereIn('cat_id', [1, 2, 3])->get();
```

whereBetween
------------

[](#wherebetween)

### argvs

[](#argvs-9)

1. attribute
2. from
3. to

### use

[](#use-9)

```
// get records if id between 1..3
$posts = Post::whereBetween('id', 1, 3)->get();
```

randomOrder
-----------

[](#randomorder)

randomize records order

### argvs

[](#argvs-10)

1. expression

### use

[](#use-10)

```
$posts = Post::randomOrder('DESC')->get();
```

orderBy
-------

[](#orderby)

### argvs

[](#argvs-11)

1. attribute
2. expression

### use

[](#use-11)

```
$posts = Post:orderBy('created_at', 'DESC')->get();
```

limit
-----

[](#limit)

### argvs

[](#argvs-12)

1. from
2. number

### use

[](#use-12)

```
// get first 3 records
$posts = Post::limit(0, 3)->get();
```

count
-----

[](#count)

### use

[](#use-13)

```
// get cound of records
$postsCount = Post::count(); // return 4
```

pagination
----------

[](#pagination)

### argvs

[](#argvs-13)

1. perpage

### use

[](#use-14)

```
// auto convert page_id with $_GET['_pageid']
$posts = Post::pagination(3);
```

Relationships
-------------

[](#relationships)

### hasOne

[](#hasone)

#### argvs

[](#argvs-14)

1. model class name
2. foreign key
3. local key

#### use

[](#use-15)

```
$user = Post::hasOne(User::class, 'user_id', 'id');
```

### hasMany

[](#hasmany)

#### argvs

[](#argvs-15)

1. model class name
2. foreign key
3. local key

#### use

[](#use-16)

```
$comments = Post::hasMany(Comment::class, 'post_id', 'id')->get();
```

### belongsTo

[](#belongsto)

#### argvs

[](#argvs-16)

1. model class name
2. foreign key
3. local key

#### use

[](#use-17)

```
$user = Post::belongTo(User::class, 'user_id', 'id')->get();
```

### belongsToMany

[](#belongstomany)

#### argvs

[](#argvs-17)

1. model class name
2. pivot table
3. local key
4. pivot foreign key
5. pivot other foreign key
6. foreign key

#### use

[](#use-18)

```
$tags = Post::belongsToMany(Tag::class, 'article_tag', 'id', 'post_id', 'tag_id', 'id')->get();
// |      *----------------------------------------------*        |         |       |
// |      *-------------------------------------------------------*         |       |
// *------------------------------------------------------------------------*       |
// *--------------------------------------------------------------------------------*
```

View
====

[](#view-1)

all views create in **resources/view**

apts template engine
--------------------

[](#apts-template-engine)

```
- resources
  - view
    - home
      - layouts
        - master.apts.php
        - head-tag.apts.php
      - index.apts.php

```

### home &gt; layouts &gt; master.apts.php

[](#home--layouts--masteraptsphp)

```
>

    @include('home.layouts.head-tag')
    @yield('title')
    @yield('head-tag')

    @yield('content')

```

### home &gt; layouts &gt; head-tag.apts.php

[](#home--layouts--head-tagaptsphp)

```

```

### home &gt; index.apts.php

[](#home--indexaptsphp)

```
@extends('app.layouts.app')

@section('head-tag')

Apantos project

@endsection

@section('content')

Welcome to apantos project

@endsection
```

render
------

[](#render)

replace **/** with **.** in your path path start in **resources/view**

```
view('home.index');
```

or

```
$message = 'Send message to view';
view('home.index', compact('message'));
```

### example using in controller

[](#example-using-in-controller)

```
namespace App\Http\Controllers\Home;

use App\Http\Controllers\Controller;

class HomeController extends Controller
{
    public function index()
    {
        $message = 'Send message to view';
        return view('home.index', compact('message'));
    }
}
```

Auth system
===========

[](#auth-system)

auth using **User** mdoel by default

registerUser
------------

[](#registeruser)

### argvs

[](#argvs-18)

1. values:array
2. password input name
3. encrypt input name:array

### use

[](#use-19)

```
$inputs = [
    'username' => 'alishahidi',
    'password' => 'decoded-secret-from-form',
    'phone_number' => '+13924324'
    'secret' => 'top secret'
];

Auth::storeUser($inputs, 'password', ['secret']);
```

updateUser
----------

[](#updateuser)

### argvs

[](#argvs-19)

1. values:array
2. allowed inputs:key=&gt;value array
3. password input name
4. encrypt input name:array

### use

[](#use-20)

```
$inputs = [
    'id' => 1,
    'username' => 'ali',
    'password' => 'decoded-secret-from-form',
];

Auth::updateUser($inputs, ['id', 'username', 'password'], 'password');
```

loginUsingEmail
---------------

[](#loginusingemail)

### argvs

[](#argvs-20)

1. email
2. decoded password
3. no user exist error message (opt)
4. password wrong error message (opt)
5. remember user (opt)
6. user cookie validate time (opt)

### use

[](#use-21)

```
Auth::loginEmailUsername('test@test.org', 'secret', "Username wrong.", "Password wrong", true, 4 * 24 * 60 * 60);
```

loginUsingUsername
------------------

[](#loginusingusername)

like `loginUsingEmail` but send username between email in first argument

loginUsingId
------------

[](#loginusingid)

### argvs

[](#argvs-21)

1. id

### use

[](#use-22)

```
Auth::loginUsingId(1);
```

logout
------

[](#logout)

### use

[](#use-23)

```
Auth::logout();
```

check
-----

[](#check)

check user login =&gt; redirect to **auth.login** route name if not login

### use

[](#use-24)

```
Auth::check();
```

checkLogin
----------

[](#checklogin)

check user login =&gt; return true/false

### use

[](#use-25)

```
$isLogin = Auth::checkLogin();
```

user
----

[](#user)

return user if login

### use

[](#use-26)

```
$user = Auth::user();
```

userUsingEmail
--------------

[](#userusingemail)

### use

[](#use-27)

```
$user = Auth::userUsingEmail('test@test.org');
```

userUsingUsername
-----------------

[](#userusingusername)

### use

[](#use-28)

```
$user = Auth::userUsingUsername('ali');
```

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 54.8% 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 ~42 days

Total

7

Last Release

1215d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3d6908ae4ba7857c1dbe8c19925378cddcb67611923aedf9c421f808999a1e6e?d=identicon)[alishahidi](/maintainers/alishahidi)

---

Top Contributors

[![alishahidi](https://avatars.githubusercontent.com/u/63677039?v=4)](https://github.com/alishahidi "alishahidi (40 commits)")[![ahmadreza1383](https://avatars.githubusercontent.com/u/61243238?v=4)](https://github.com/ahmadreza1383 "ahmadreza1383 (33 commits)")

---

Tags

fastframeworklightweightphpsecurityframeworkapantos

###  Code Quality

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/alishahidi-apantos/health.svg)

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

###  Alternatives

[laravel/framework

The Laravel Framework.

34.6k509.9M17.0k](/packages/laravel-framework)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[laravel-zero/framework

The Laravel Zero Framework.

3371.4M368](/packages/laravel-zero-framework)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)

PHPackages © 2026

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