Download the PHP package hasyirin/laravel-address without Composer

On this page you can find all versions of the php package hasyirin/laravel-address. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-address

Laravel Address

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

A Laravel package for managing addresses with polymorphic relationships and hierarchical geographical data (countries, states, districts, subdistricts, and post offices).

Comes with built-in geographical data for Malaysia and a seeder command to populate reference tables.

Requirements

Installation

Install the package via Composer:

Publish and run the migrations:

Optionally publish the config file:

Seeding Geographical Data

Seed countries, states, districts, subdistricts, and post offices:

The command loads data from the package's data/ directory. To use your own data, place JSON files in your application's base_path('data') directory following the same structure.

Usage

Preparing Your Model

Add the InteractsWithAddresses trait to any model that should have addresses:

Creating Addresses

Using the Factory

The Address model includes a factory for testing:

Retrieving Addresses

Querying by Type

The ofType scope accepts a string, array, or enum:

Formatting

HTML Rendering

Copying an Address

Create an unsaved copy of an address (without the polymorphic relationship or type):

Locality

Designate a "local" country, state, and district by setting their codes in config/address.php:

Resolve them anywhere via the static helper — it enforces the parent chain, so a state only counts as local if its country also matches the configured code:

If any level is null in the config, the corresponding local() returns null.

Compose with the local() query scope:

The result is memoized per request via cache()->memo(). saved and deleted listeners on each model cascade-clear caches down the chain (Country save clears State and District caches too). For manual invalidation:

Configuration

Data Structure

The package uses a hierarchical location model:

Each Address belongs to a Country, State, and optionally a PostOffice, and is polymorphically attached to any model via the addressable morph relationship.

Models

Model Key Fields
Country code (ISO 3166-1 alpha-3), alpha_2, name
State code, name, belongs to Country
District code, name, belongs to State
Subdistrict code, name, belongs to District
PostOffice name, postcodes (JSON array), belongs to State
Address type, line_1-line_3, postcode, latitude, longitude, properties (JSON)

All models use soft deletes.

Extending Models

To use your own model classes, extend the package models and update the config:

Testing

Changelog

Please see CHANGELOG for more information on what has changed recently.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-address with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
spatie/laravel-package-tools Version ^1.16
illuminate/contracts Version ^12.0||^13.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package hasyirin/laravel-address contains the following files

Loading the files please wait ...