adultdate / filament-postnummer
A Filament v4 plugin for managing Swedish postal codes (postnummer) with data from multiple sources (Hitta, Ratsit, Merinfo).
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:filament-plugin
pkg:composer/adultdate/filament-postnummer
Requires
- php: ^8.2
- filament/filament: ^4.0
- spatie/laravel-package-tools: ^1.15.0
Requires (Dev)
- laravel/pint: ^1.0
- orchestra/testbench: ^9.0
This package is auto-updated.
Last update: 2025-12-17 17:56:09 UTC
README
A comprehensive Filament v4 plugin for managing Swedish postal codes (postnummer) with data integration from multiple sources including Hitta, Ratsit, and Merinfo.
Features
- Complete Filament Resource: Full CRUD operations for Swedish postal codes
- Multi-Source Data Integration: Track data from Hitta, Ratsit, and Merinfo
- Advanced Filtering: Filter by status, active status, and phone availability
- API Endpoints: RESTful API for external integrations
- Export Functionality: Export data in various formats
- Queue Management: Built-in queue management for data processing
- Detailed Statistics: Track counts, saved records, and processing progress
Installation
1. Install via Composer
composer require adultdate/filament-postnummer
2. Publish Configuration
php artisan vendor:publish --tag="filament-postnummer-config"
3. Publish and Run Migrations
php artisan vendor:publish --tag="filament-postnummer-migrations"
php artisan migrate
4. Register Plugin
Add the plugin to your Filament panel provider (usually app/Providers/Filament/AdminPanelProvider.php):
use Adultdate\FilamentPostnummer\FilamentPostnummerPlugin; public function panel(Panel $panel): Panel { return $panel // ... other panel configuration ->plugin(FilamentPostnummerPlugin::make()); }
Configuration
The plugin configuration file is published at config/filament-postnummer.php. You can customize:
- Table name
- API routes prefix and middleware
- Resource navigation settings
- External data source configurations
Database Schema
The plugin creates a postnummer table with the following main fields:
post_nummer: Postal code (e.g., "123 45")post_ort: City namepost_lan: County/region- Data counts and saved records from Hitta, Ratsit, and Merinfo
- Queue management flags
- Status tracking
- Timestamps
API Routes
The plugin provides the following API endpoints under /api/postnummer:
GET /- List all postnummer with filtering and paginationGET /{postNummer}- Get specific postnummerPUT /{postNummer}- Update specific postnummerPOST /bulk-update- Bulk update multiple postnummer
API Usage Examples
Get all postnummer
curl -X GET "http://your-app.com/api/postnummer?per_page=50&status=active"
Get specific postnummer
curl -X GET "http://your-app.com/api/postnummer/123%2045"
Update postnummer
curl -X PUT "http://your-app.com/api/postnummer/123%2045" \ -H "Content-Type: application/json" \ -d '{"status": "completed", "is_active": true}'
Bulk update
curl -X POST "http://your-app.com/api/postnummer/bulk-update" \ -H "Content-Type: application/json" \ -d '{ "post_nummers": ["123 45", "123 46"], "data": {"status": "processing"} }'
Filament Resource Features
Table Columns
- Basic info: Postal code, city, county
- Data source groups: Hitta, Ratsit, Merinfo with counts and saved records
- Status indicators and queue flags
- Timestamps
Filters
- Status filter (pending, running, complete)
- Active status filter
- Phone availability filter
Actions
- Standard CRUD operations
- Bulk actions for data management
- Export functionality
Data Sources
The plugin tracks data from three main Swedish directories:
Hitta.se
- Total person and company counts
- Saved records with phone and house information
- Queue management for data processing
Ratsit.se
- Person and company data
- Phone and house information
- Processing queues
Merinfo.se
- Comprehensive person and company data
- Phone number tracking
- Queue and count management
Queue Management
The plugin includes built-in queue management for processing data from external sources:
- Individual queue flags for each data source
- Bulk queue operations
- Progress tracking
- Status management
Export Functionality
Export postnummer data in various formats:
- CSV
- Excel (XLSX)
- SQLite database
Customization
Custom Fields
You can extend the Postnummer model with custom fields by:
- Publishing the migration
- Adding your columns to the migration
- Updating the model's
$fillableand$castsarrays - Modifying the form schema and table columns
Custom Actions
Add custom bulk actions by extending the PostnummersTable class:
// In your custom table class public static function configure(Table $table): Table { return $table ->actions([ // ... existing actions Action::make('customAction') ->label('Custom Action') ->action(function ($record) { // Your custom logic }), ]); }
Troubleshooting
Migration Issues
If you encounter migration conflicts, you can:
- Publish the migration:
php artisan vendor:publish --tag="filament-postnummer-migrations" - Modify the published migration file in
database/migrations/ - Run the migration manually:
php artisan migrate
Route Conflicts
If API routes conflict with existing routes, customize the prefix in the configuration file:
// config/filament-postnummer.php 'api' => [ 'prefix' => 'api/custom-postnummer', ],
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
License
This plugin is open-sourced software licensed under the MIT license.
Support
For support and questions:
- Create an issue in the GitHub repository
- Contact: support@adultdate.com
Changelog
v1.0.0
- Initial release
- Complete Filament v4 integration
- API endpoints
- Multi-source data tracking
- Queue management
- Export functionality# filament-postnummer