PHP code example of buibr / address
1. Go to this page and download the library: Download buibr/address library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
buibr / address example snippets
$address = new Buibr\Address\Address();
echo $address->id;
class User {
use HasAddress;
}
$user = User::first($id);
$user->adresses; // Collection[Address]
$user->addresses() // HasMany
$user->hasAddress() // boolean
$user->addAddress([...]) // AddressInterface
$user->primaryAddress // Address.is_primary = tru or first address
$user->shippingAddress // Address or null
$user->billingAddress // Address or null
// full formated address from config/addresses.php ['name_format']
$user->primaryaddress->name