PHPackages                             yahaaylabs/laravel-barangay-search - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. yahaaylabs/laravel-barangay-search

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

yahaaylabs/laravel-barangay-search
==================================

A Laravel Livewire component for searching Philippine Barangays with Mary UI support

v0.1.4(3mo ago)14MITPHPPHP ^8.1

Since Feb 15Pushed 3mo agoCompare

[ Source](https://github.com/YahaayLabs/laravel-barangay-search)[ Packagist](https://packagist.org/packages/yahaaylabs/laravel-barangay-search)[ RSS](/packages/yahaaylabs-laravel-barangay-search/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (5)Versions (6)Used By (0)

Laravel Barangay Search
=======================

[](#laravel-barangay-search)

[![Latest Version on Packagist](https://camo.githubusercontent.com/0d6520e8a1fab761b473071b9cec8f3ed0b098f059237e07c07a9972a3e7c6c7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7961686161796c6162732f6c61726176656c2d626172616e6761792d7365617263682e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/yahaaylabs/laravel-barangay-search)[![Total Downloads](https://camo.githubusercontent.com/6fa54064fa2755fb0d50397e7db0a100fae8acb2069acc733b698152d876bfd6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7961686161796c6162732f6c61726176656c2d626172616e6761792d7365617263682e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/yahaaylabs/laravel-barangay-search)

A Laravel Livewire component for searching Philippine Barangays with optional Mary UI support. This package uses the [GIS.PH SDK](https://github.com/yahaaylabs/gis.ph-sdk-php) to interact with the official [GIS.PH API](https://gis.ph).

Features
--------

[](#features)

- 🔍 **Autocomplete Search** - Real-time Barangay Search with debouncing
- 🎨 **Mary UI Support** - Pre-styled components using Mary UI (optional)
- 💾 **Caching** - Intelligent caching to reduce API calls
- 🎯 **Filtering** - Filter by municipality, city, or province
- 🔧 **Customizable** - Fully customizable UI and behavior
- ⚡ **Fast** - Optimized for performance
- 📦 **Easy Integration** - Drop-in component for any Laravel Livewire app

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

[](#requirements)

- PHP 8.1 or higher
- Laravel 10.x or 11.x
- Livewire 3.x
- [GIS.PH API Key](https://gis.ph)

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

[](#installation)

### 1. Install via Composer

[](#1-install-via-composer)

```
composer require yahaaylabs/laravel-barangay-search
```

### 2. Publish Configuration (Optional)

[](#2-publish-configuration-optional)

```
php artisan vendor:publish --tag=barangay-search-config
```

### 3. Publish Views (Optional)

[](#3-publish-views-optional)

If you want to customize the views:

```
php artisan vendor:publish --tag=barangay-search-views
```

### 4. Set Your API Key

[](#4-set-your-api-key)

Add your GIS.PH API key to your `.env` file:

```
GISPH_API_KEY=your_api_key_here
```

Get your API key from

Quick Start
-----------

[](#quick-start)

### Basic Usage

[](#basic-usage)

```

```

### With Form Integration

[](#with-form-integration)

```

```

### Listening to Events

[](#listening-to-events)

```

@script

    $wire.on('barangay-selected', (event) => {
        console.log('Selected:', event.barangay);
        // Do something with the selected barangay
    });

    $wire.on('barangay-cleared', () => {
        console.log('Selection cleared');
    });

    $wire.on('barangay-search-error', (event) => {
        console.error('Search error:', event.error);
    });

@endscript
```

Component Props
---------------

[](#component-props)

PropTypeDefaultDescription`wire:model`mixed`null`Bind the selected barangay`label`string`''`Label text above the input`placeholder`stringConfig valuePlaceholder text for the input`required`boolean`false`Mark field as required`clearable`boolean`true`Show clear button`hint`string`''`Helper text below the input`municipalityCode`string`null`Filter results by municipality code`cityCode`string`null`Filter results by city code`provinceCode`string`null`Filter results by province code`containerClass`string`''`Additional CSS classes for container`inputClass`string`''`Additional CSS classes for inputAdvanced Usage
--------------

[](#advanced-usage)

### Filtering by Municipality

[](#filtering-by-municipality)

```

```

### Filtering by Province

[](#filtering-by-province)

```

```

### Custom Styling

[](#custom-styling)

```

```

### Using Without Mary UI

[](#using-without-mary-ui)

If you don't want to use Mary UI styling, update your config:

```
// config/barangay-search.php
'ui' => [
    'use_mary_ui' => false, // Use vanilla styling
],
```

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

[](#configuration)

The configuration file `config/barangay-search.php` provides several customization options:

```
return [
    'api_key' => env('GISPH_API_KEY'),

    'cache' => [
        'enabled' => true,
        'ttl' => 3600, // 1 hour
        'prefix' => 'barangay_search',
    ],

    'search' => [
        'min_query_length' => 2,
        'debounce_ms' => 300,
        'max_results' => 20,
    ],

    'ui' => [
        'placeholder' => 'Search for a barangay...',
        'no_results_text' => 'No barangays found',
        'loading_text' => 'Searching...',
        'use_mary_ui' => true,
    ],
];
```

Using the Service Directly
--------------------------

[](#using-the-service-directly)

You can also use the `BarangayService` directly in your controllers or other classes:

```
use YahaayLabs\LaravelBarangaySearch\Services\BarangayService;

class YourController extends Controller
{
    public function __construct(
        protected BarangayService $barangayService
    ) {}

    public function search(Request $request)
    {
        $results = $this->barangayService->search(
            query: $request->input('q'),
            filters: [
                'municipality_code' => $request->input('municipality_code')
            ]
        );

        return response()->json($results);
    }

    public function getByCode(string $code)
    {
        $barangay = $this->barangayService->getByCode($code);

        return response()->json($barangay);
    }

    public function getByMunicipality(string $municipalityCode)
    {
        $barangays = $this->barangayService->getByMunicipality($municipalityCode);

        return response()->json($barangays);
    }
}
```

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

[](#response-format)

When a barangay is selected, the component returns an array with the following structure:

```
[
    'code' => '012345678',
    'name' => 'Barangay Name',
    'municipality' => 'Municipality Name',
    'municipality_code' => '012345',
    'city' => 'City Name', // nullable
    'city_code' => '012345', // nullable
    'province' => 'Province Name',
    'province_code' => '0123',
    'region' => 'Region Name',
    'region_code' => '01',
    'full_address' => 'Barangay Name, Municipality Name, Province Name',
]
```

Events
------

[](#events)

The component dispatches the following events:

### `barangay-selected`

[](#barangay-selected)

Fired when a barangay is selected from the dropdown.

```
$wire.on('barangay-selected', (event) => {
    console.log(event.barangay); // Selected barangay object
});
```

### `barangay-cleared`

[](#barangay-cleared)

Fired when the selection is cleared.

```
$wire.on('barangay-cleared', () => {
    // Handle clear action
});
```

### `barangay-search-error`

[](#barangay-search-error)

Fired when a search error occurs.

```
$wire.on('barangay-search-error', (event) => {
    console.error(event.error); // Error message
});
```

Caching
-------

[](#caching)

The package includes built-in caching to reduce API calls:

```
// Clear all cached searches
use YahaayLabs\LaravelBarangaySearch\Services\BarangayService;

app(BarangayService::class)->clearCache();
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

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

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

[](#contributing)

Contributions are welcome! Please feel free to submit a Pull Request.

Security
--------

[](#security)

If you discover any security-related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [YahaayLabs](https://github.com/YahaayLabs)
- Built using [GIS.PH SDK](https://github.com/yahaaylabs/gis.ph-sdk-php)
- Powered by [GIS.PH API](https://gis.ph)

License
-------

[](#license)

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

Support
-------

[](#support)

For support, email  or visit our [documentation](https://docs.yahaaylabs.com).

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance82

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 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 ~0 days

Total

5

Last Release

92d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/bb61e07b328ef894264923d2982daefb40a1bb906415b9f7fae6bf329014e497?d=identicon)[gerald](/maintainers/gerald)

---

Top Contributors

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

---

Tags

laravellivewiregisphilippinesbarangaymary-ui

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/yahaaylabs-laravel-barangay-search/health.svg)

```
[![Health](https://phpackages.com/badges/yahaaylabs-laravel-barangay-search/health.svg)](https://phpackages.com/packages/yahaaylabs-laravel-barangay-search)
```

###  Alternatives

[livewire/flux

The official UI component library for Livewire.

9475.0M86](/packages/livewire-flux)[rappasoft/laravel-livewire-tables

A dynamic table component for Laravel Livewire

2.0k2.7M31](/packages/rappasoft-laravel-livewire-tables)[mediconesystems/livewire-datatables

Advanced datatables using Laravel, Livewire, Tailwind CSS and Alpine JS

1.2k711.3k8](/packages/mediconesystems-livewire-datatables)[livewire/volt

An elegantly crafted functional API for Laravel Livewire.

4205.3M84](/packages/livewire-volt)[spatie/laravel-livewire-wizard

Build wizards using Livewire

4061.0M4](/packages/spatie-laravel-livewire-wizard)[bezhansalleh/filament-google-analytics

Google Analytics integration for FilamentPHP

205144.8k5](/packages/bezhansalleh-filament-google-analytics)

PHPackages © 2026

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