PHPackages                             lukman-ss/intisari-api - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. lukman-ss/intisari-api

ActiveProject[HTTP &amp; Networking](/categories/http)

lukman-ss/intisari-api
======================

Lightweight RESTful API starter based on IntisariPHP

v0.2.4(1mo ago)06MITPHPPHP &gt;=8.2CI passing

Since Jul 9Pushed 1mo agoCompare

[ Source](https://github.com/lukman-ss/intisari-api)[ Packagist](https://packagist.org/packages/lukman-ss/intisari-api)[ RSS](/packages/lukman-ss-intisari-api/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (9)Dependencies (6)Versions (10)Used By (0)

Intisari API
============

[](#intisari-api)

A lightweight RESTful API starter built on top of IntisariPHP.

Requirements
------------

[](#requirements)

- PHP 8.2 or higher
- SQLite PDO extension
- Composer

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

[](#installation)

Create a new project using Composer:

```
composer create-project lukman-ss/intisari-api your-project-name
cd your-project-name
```

Environment Setup
-----------------

[](#environment-setup)

Copy the example environment file:

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

**Important**: The default `.env.example` is secured for production. To run the API locally, open your `.env` file, comment out the production database and CORS settings, and uncomment the `LOCAL DEVELOPMENT OVERRIDES` section at the bottom.

Ensure the local SQLite database file exists (if using local development overrides):

```
touch database/api.sqlite
```

*(Alternatively, you can run `make install` if you are on a Unix-based system to handle both setup steps.)*

Run Development Server
----------------------

[](#run-development-server)

To start the built-in PHP development server, use the composer script:

```
composer serve
```

The API will be available at `http://localhost:8000`.

Database Migration
------------------

[](#database-migration)

Run the database migrations to set up the default tables (`users`, `posts`, `api_tokens`):

```
composer migrate
```

If you need to refresh the database (drop and re-run all migrations) and optionally seed initial data:

```
composer fresh
composer seed
```

Authentication Flow
-------------------

[](#authentication-flow)

This project uses a simple Bearer Token authentication mechanism.

1. **Register**: Send a `POST` request to `/api/auth/register` with `name`, `email`, and `password`. You will receive a token in the response.
2. **Login**: Send a `POST` request to `/api/auth/login` with `email` and `password` to obtain a new token.
3. **Usage**: Include the token in the `Authorization` header of subsequent requests: ```
    Authorization: Bearer YOUR_TOKEN_HERE

    ```
4. **Logout**: Send a `POST` request to `/api/auth/logout` to revoke your current token.

Example API Request
-------------------

[](#example-api-request)

Here is an example of creating a new post:

```
curl -X POST http://localhost:8000/api/posts \
  -H "Authorization: Bearer YOUR_TOKEN_HERE" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "My First Post",
    "content": "Hello World",
    "status": "published"
  }'
```

Testing
-------

[](#testing)

The project is fully tested using PHPUnit, with automatic in-memory SQLite isolation for feature tests.

To run the test suite:

```
composer test
```

To run syntax checks and code validation:

```
composer source:check
```

Project Structure
-----------------

[](#project-structure)

- `app/`: Core application code (Controllers, Middleware, Exceptions, Support, Repositories).
- `bootstrap/`: Application and container bootstrapping.
- `config/`: Application configuration files.
- `database/`: SQLite database file and migration scripts.
- `docs/`: OpenAPI specifications and Markdown documentation.
- `public/`: Web server entry point (`index.php`).
- `routes/`: Route definitions (`api.php`, `console.php`).
- `tests/`: Feature and Unit tests.
- `scripts/`: Development and maintenance scripts.

Secure Deployment
-----------------

[](#secure-deployment)

To ensure this API operates securely in a production environment, strictly adhere to the following baseline requirements. For complete details, see our [SECURITY.md](SECURITY.md).

- **Environment Config**: Never commit `.env` to Git. Ensure `APP_DEBUG=false` to prevent sensitive stack trace leaks.
- **HTTPS &amp; Proxy**: Production traffic **must** run over HTTPS. If placed behind a reverse proxy (e.g., Nginx), ensure headers like `X-Forwarded-For` are trusted securely.
- **Database Credentials**: MySQL/PostgreSQL require explicit, strong credentials. Do not fallback to root or empty passwords.
- **CORS Allowlist**: Do not use `*` for `CORS_ALLOWED_ORIGINS` in production. Specify exact frontend domains explicitly.
- **Rate Limiting**: The built-in file-based rate limiter is for low-traffic/local use. For production, switch to a robust Redis/Memcached backend or handle throttling at the reverse proxy.
- **Token Least-Privilege**: Grant API tokens only the absolute minimum abilities required. Never default to wildcard (`*`) abilities for user-facing tokens.
- **Storage Permissions**: Ensure that `storage/` and any SQLite database directories are writable by the web server but **never** accessible directly via the public web root.
- **Composer Audit**: Regularly run `composer security:check` (which includes `composer audit --locked`) in your CI pipeline to catch vulnerable dependencies.
- **Logging &amp; Secrets**: Use the built-in redaction for sensitive keys (`password`, `token`, etc.) in `storage/logs/app.log`. Manage secrets using secure environment managers or vaults.
- **Migrations**: Run `composer migrate` cautiously in production. Use `--force` mechanisms appropriately to prevent accidental destructive migrations.
- **Backup**: Regularly back up your database and `.env` securely off-site.

License
-------

[](#license)

This project is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance93

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~1 days

Total

9

Last Release

35d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/64991223?v=4)[Lukman](/maintainers/lukman-ss)[@lukman-ss](https://github.com/lukman-ss)

---

Top Contributors

[![lukman-ss](https://avatars.githubusercontent.com/u/64991223?v=4)](https://github.com/lukman-ss "lukman-ss (10 commits)")

---

Tags

phpapirestlightweightstarterintisari

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/lukman-ss-intisari-api/health.svg)

```
[![Health](https://phpackages.com/badges/lukman-ss-intisari-api/health.svg)](https://phpackages.com/packages/lukman-ss-intisari-api)
```

PHPackages © 2026

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