Download the PHP package fredoware/fredobase without Composer
On this page you can find all versions of the php package fredoware/fredobase. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download fredoware/fredobase
More information about fredoware/fredobase
Files in fredoware/fredobase
Package fredobase
Short Description A lightweight plain-PHP framework for database-backed CRUD APIs.
License
Informations about the package fredobase
FredoBase
FredoBase is a lightweight plain-PHP API micro framework by Fredoware for quickly creating database-backed CRUD APIs.
It is intentionally small, readable, and easy to copy for future Fredoware projects.
FredoBase gives you:
- one bootstrap file
- reusable request/response/database helpers
- model factory functions
- file-based API endpoints
- SQL migrations
- module generator
Structure
Install With Composer
After the package is published on Packagist, create an application with:
Composer installs the dependencies and runs php fredobase install. The
installer creates .env, generates a unique APP_KEY, and never overwrites an
existing environment file.
Before the package is on Packagist, it can be tested directly from GitHub:
Manual Setup
-
Install dependencies and prepare the project:
-
Check your database settings in
.env: -
Run migrations:
- Test the health endpoint:
Expected response:
CLI Commands
Show help:
Prepare a new checkout (safe to run more than once):
Create a CRUD module:
Run migrations:
After adding a field to a module model, generate and apply its migration:
The module generator creates:
It also registers REST routes inside routes/api.php.
Starter Endpoints
api/health.php- API and database health checkapi/authLogin.php- basic account loginapi/authLogout.php- revoke the current bearer tokenapi/index.php- dispatch routed module requests
Starter Tables
account- minimal user/account tableauth_token- hashed, expiring bearer tokenssample_item- generic CRUD example table
Creating A New Module
Read the full tutorial:
docs/creating-a-module.md
Quick version:
Then test:
Write routes require a bearer token by default. Existing file-based endpoints remain supported for backward compatibility.
Authentication
Run migrations and create the first administrator:
Login with a JSON POST request to api/authLogin.php. A successful response
contains a bearer token. Send it to protected endpoints with:
Protect an endpoint and access the authenticated account with:
Require one or more roles with:
Revoke the current token by sending an authenticated POST request to
api/authLogout.php. Token lifetime defaults to 24 hours and can be changed
with AUTH_TOKEN_TTL in .env.
GitHub Notes
Commit .env.example, but do not commit .env.
The .gitignore already excludes .env, logs, temporary files, and uploaded media.
fredobaseapi
All versions of fredobase with dependencies
ext-json Version *
ext-pdo Version *
phpmailer/phpmailer Version ^6.8
authorizenet/authorizenet Version ^2.0