DressAPI API - REST API layer built on DressAPI Core.

Maintainers

Package info

git.dressapi.com/dressapi/api

pkg:composer/dressapi/api

Statistics

Installs: 12

Dependents: 0

Suggesters: 0

3.0.8 2026-05-06 07:58 UTC

This package is not auto-updated.

Last update: 2026-05-06 08:03:52 UTC


README

DressAPI API is a pure REST API implementation built on DressAPI Core. It exposes your database as a JSON API with zero boilerplate — designed to be consumed by decoupled frontends such as Vue, React, Angular, or any HTTP client.

It is also used by DressAPI CMS to power select elements (picklists) for related tables in the admin interface.

License: Apache 2.0 · Author: Tufano Pasquale · Version: 3.0.6

What distinguishes API from CMS

DressAPI APIDressAPI CMS
OutputJSON (default), XML, plain textHTML (server-side rendered)
AuthenticationJWT onlyJWT + cookie sessions
FrontendExternal (Vue, React, Angular, AJAX)Included (template engine)
Use caseHeadless / decoupled architectureIntegrated CMS

Requirements

ComponentMinimumNotes
PHP8.1Extensions: pdo_mysql, curl, mbstring, json
MySQL5.7Or MariaDB >= 10.3
Apache2.4mod_rewrite required
Composer2.x

Installation

Via Composer

composer require dressapi/api

Via Git

git clone https://git.dressapi.com/dressapi/api.git
cd api
composer install

Configuration

Copy config.php.sample to config.php and edit:

<?php
define('DOMAIN_NAME', 'yourdomain.com');
define('APP_NAME',    'myapp');
define('APP_ENV',     'production'); // develop | stage | production

// IMPORTANT: change before going to production
define('TOKEN_SECRET_KEY', 'your-unique-jwt-secret');
define('PWD_CRYPT',        'your-unique-crypt-key');

// Database
define('DB_HOST',     'localhost');
define('DB_PORT',     3306);
define('DB_NAME',     'mydb');
define('DB_USERNAME', 'myuser');
define('DB_PASSWORD', 'mypassword');

Database Setup

mysql -u root -p -e "CREATE DATABASE mydb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
mysql -u root -p mydb < _SETUP/dressapi_cms.sql

Default admin credentials (change immediately in production):

RoleEmailPassword
Adminadmin@dressapi.comadmin

Apache Configuration

sudo cp _SETUP/api.dressapi.com.conf /etc/apache2/sites-available/
sudo a2ensite api.dressapi.com
sudo systemctl reload apache2

Authentication

Login

curl -X POST https://yourapi.com/sign \
     -d "dusername=admin&dpassword=yourpassword"

Response:

{
  "token": "eyJ0eXAiOiJKV1Qi..."
}

Authenticated requests

curl -H "Authorization: Bearer <token>" \
     -X GET https://yourapi.com/article

API Reference

HTTP Methods

MethodAction
GETRead one or more records
POSTInsert a new record
PUTFull update of a record
PATCHPartial update of a record
DELETEDelete a record
OPTIONSReturn field types and allowed methods

URL Parameters

ParameterShortExampleDescription
fullfull/article/fullResolve foreign keys to human-readable values
pagep/article/p/2Page 2 (default: 20 items per page)
/article/p/2,10Page 2, 10 items per page
order-byob/article/ob/titleOrder by field ASC
/article/ob/id-DESCOrder by field DESC

Filters

Append {field}{operator}{value} to the path:

OperatorMeaning
=Equals
< > >= <=Comparison
~Contains (LIKE)

Examples

# Read with relations, ordered, paginated
curl -H "Authorization: Bearer <token>" \
     -X GET "https://yourapi.com/article/full/ob/id-DESC/p/1,10"

# Filter: articles by user, containing "hello" in title
curl -H "Authorization: Bearer <token>" \
     -X GET "https://yourapi.com/article/id_user=1/title~hello"

# Insert
curl -H "Authorization: Bearer <token>" \
     -X POST https://yourapi.com/article \
     -d "title=Hello&body=Content&id_user=1"

# Partial update
curl -H "Authorization: Bearer <token>" \
     -X PATCH https://yourapi.com/article/1 \
     -d "title=Updated"

# Delete
curl -H "Authorization: Bearer <token>" \
     -X DELETE https://yourapi.com/article/1

Output Formats

-H 'Accept: application/json'   # default
-H 'Accept: application/xml'
-H 'Accept: text/plain'

Related Projects

ProjectDescription
dressapi/coreFramework core library
dressapi/cmsServer-side CMS (uses this API for picklists)
dressapi/vueVue 3 frontend
dressapi/reactReact frontend
dressapi/angularAngular frontend
dressapi/ajaxVanilla JS frontend

License

Apache 2.0 — free for personal and commercial use.

Official site

dressapi.com