PHPackages                             aslammaududy/laravel-api-co-id - 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. [API Development](/categories/api)
4. /
5. aslammaududy/laravel-api-co-id

ActiveLibrary[API Development](/categories/api)

aslammaududy/laravel-api-co-id
==============================

Laravel wrapper for api.co.id

v1.0.0(yesterday)00MITPHPPHP ^8.4CI passing

Since Jun 30Pushed todayCompare

[ Source](https://github.com/aslammaududy/laravel-api-co-id)[ Packagist](https://packagist.org/packages/aslammaududy/laravel-api-co-id)[ Docs](https://github.com/aslammaududy/laravel-api-co-id)[ GitHub Sponsors](https://github.com/Aslam)[ RSS](/packages/aslammaududy-laravel-api-co-id/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (12)Versions (2)Used By (0)

Laravel wrapper for api.co.id
=============================

[](#laravel-wrapper-for-apicoid)

[![Latest Version on Packagist](https://camo.githubusercontent.com/5b1e3b628fa1d2451ffe1bbd2febb8228b3bb465ca6df38f3d18e26748771b8d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f61736c616d6d6175647564792f6c61726176656c2d6170692d636f2d69642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/aslammaududy/laravel-api-co-id)[![GitHub Tests Action Status](https://camo.githubusercontent.com/231bee43a05a7ff1f0aaceec4f4eeb9bc097b1e4e3d8da4ea0598909349f0d20/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f61736c616d6d6175647564792f6c61726176656c2d6170692d636f2d69642f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/aslammaududy/laravel-api-co-id/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/d2dbf031b59ea9769c0f61c1f4d22a7360bd0dda9bf873ce1be255c17c2e6a34/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f61736c616d6d6175647564792f6c61726176656c2d6170692d636f2d69642f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/aslammaududy/laravel-api-co-id/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/c4752acbae260d739afe495caf4e6041a78c94abda1a785149a22e4019a0d8d1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f61736c616d6d6175647564792f6c61726176656c2d6170692d636f2d69642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/aslammaududy/laravel-api-co-id)

A Laravel package wrapping the [api.co.id](https://api.co.id) Indonesia Regional API with a fluent query builder.

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

[](#installation)

```
composer require aslammaududy/laravel-api-co-id
```

You can publish the config file with:

```
php artisan vendor:publish --tag="laravel-api-co-id-config"
```

Configuration
-------------

[](#configuration)

Add these to your `.env`:

```
API_CO_ID_API_KEY=your-api-key-here
```

Usage
-----

[](#usage)

### Free Endpoints

[](#free-endpoints)

```
use Aslam\ApiCoId\Facades\Indonesia;

// List all provinces
Indonesia::provinces()->get();

// Get a single province
Indonesia::province('11')->get();

// Get regencies of a province
Indonesia::province('11')->regencies()->get();

// Filter regencies by province code
Indonesia::regencies()->where('province_code', '11')->get();

// Filter with like operator
Indonesia::regencies()->where('name', 'like', '%Timur%')->get();

// Get districts of a regency
Indonesia::regencies()->where('name', 'like', '%Timur%')->first();
Indonesia::district('110101')->get();
Indonesia::district('110101')->villages()->get();

// List villages with filter
Indonesia::villages()->where('district_code', '110101')->get();
Indonesia::villages()->where('name', 'like', '%Jakarta%')->page(2)->get();

// Get a single village
Indonesia::village('1101011001')->get();
```

### Pagination

[](#pagination)

```
// Paginate with 10 items per page
$paginator = Indonesia::provinces()->paginate(10);

// Paginate with filters
$paginator = Indonesia::villages()
    ->where('district_code', '110101')
    ->paginate(50);

// Access pagination methods
echo $paginator->currentPage();
echo $paginator->lastPage();
echo $paginator->total();
foreach ($paginator->items() as $item) {
    // ...
}
```

### Single Result

[](#single-result)

```
$province = Indonesia::province('11')->first();
// Returns ?array - null if not found

$province = Indonesia::provinces()->where('name', 'Aceh')->first();
```

### Paid Endpoints

[](#paid-endpoints)

```
// Search across all regions
Indonesia::search('Jakarta')->get();

// Look up postal code
Indonesia::postalCode('12345')->get();
```

> **More endpoints coming soon.**

Pricing
-------

[](#pricing)

api.co.id uses a **pay-as-you-go points system**. You top up points, and each successful API call deducts points according to the endpoint's cost.

EndpointCostTypeProvinces, Regencies, Districts, Villages**0 points**🆓 FreeSearch, Postal Codes**2 points**💰 PaidKTP OCR, SIM OCR150–300 points💰 Paid**If your points run out**, the API returns `402 Insufficient Balance` or `403 Premium Required`. The package throws an `ApiException` with the API's error message — no action needed, just top up your points.

> **Note:** All endpoints are accessible regardless of your balance. The API itself decides whether you have enough points. There's no need to toggle any "premium mode" setting.

### Fluent Chaining

[](#fluent-chaining)

All configuration methods return `$this`, enabling method chaining:

```
Indonesia::villages()
    ->where('district_code', '110101')
    ->where('name', 'like', '%Sari%')
    ->page(2)
    ->get();
```

### Testing Connection

[](#testing-connection)

```
php artisan api-co-id:check
```

Response Format
---------------

[](#response-format)

The API returns:

```
{
    "is_success": true,
    "message": "Success",
    "data": [...],
    "paging": {
        "page": 1,
        "size": 100,
        "total_item": 34,
        "total_page": 1
    }
}
```

The `get()` method extracts and returns the `data` array. The `paginate()` method returns a `LengthAwarePaginator` instance.

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Aslam](https://github.com/aslammaududy)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance100

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity50

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

Unknown

Total

1

Last Release

1d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/10533422?v=4)[Aslam Maududy Atturraby](/maintainers/aslammaududy)[@aslammaududy](https://github.com/aslammaududy)

---

Top Contributors

[![aslammaududy](https://avatars.githubusercontent.com/u/10533422?v=4)](https://github.com/aslammaududy "aslammaududy (7 commits)")

---

Tags

laravelAslamlaravel-api-co-id

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/aslammaududy-laravel-api-co-id/health.svg)

```
[![Health](https://phpackages.com/badges/aslammaududy-laravel-api-co-id/health.svg)](https://phpackages.com/packages/aslammaududy-laravel-api-co-id)
```

###  Alternatives

[dedoc/scramble

Automatic generation of API documentation for Laravel applications.

2.1k11.2M95](/packages/dedoc-scramble)[spatie/laravel-permission

Permission handling for Laravel 12 and up

12.9k102.4M1.3k](/packages/spatie-laravel-permission)[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.8M46](/packages/spatie-laravel-pdf)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

815320.5k3](/packages/defstudio-telegraph)[spatie/laravel-passkeys

Use passkeys in your Laravel app

471890.7k35](/packages/spatie-laravel-passkeys)[codewithdennis/filament-select-tree

The multi-level select field enables you to make single selections from a predefined list of options that are organized into multiple levels or depths.

329530.5k29](/packages/codewithdennis-filament-select-tree)

PHPackages © 2026

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