PHP code example of tourze / delivery-address-bundle
1. Go to this page and download the library: Download tourze/delivery-address-bundle 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/ */
tourze / delivery-address-bundle example snippets
return [
// ...
Tourze\DeliveryAddressBundle\DeliveryAddressBundle::class => ['all' => true],
];
use Tourze\DeliveryAddressBundle\Entity\DeliveryAddress;
// Entity fields:
// - id: Primary key (BIGINT)
// - user: UserInterface relation (owner)
// - sn: Unique snowflake identifier
// - consignee: Recipient name (max 50 chars)
// - mobile: Contact phone number (max 20 chars)
// - country: Country name (optional, max 64 chars)
// - province: Province/state (max 64 chars)
// - provinceCode: Province code (optional, max 20 chars)
// - city: City name (max 64 chars)
// - cityCode: City code (optional, max 20 chars)
// - district: District/county (max 64 chars)
// - districtCode: District code (optional, max 20 chars)
// - addressLine: Detailed address (max 255 chars)
// - postalCode: Postal/ZIP code (optional, max 20 chars)
// - addressTag: Address label like "home", "office" (optional, max 20 chars)
// - gender: Gender enum (optional, using GB/T 2261 standard)
// - isDefault: Default address flag (boolean)
// - createTime/updateTime: Timestamps (auto-managed)
// - createdBy/updatedBy: Blameable tracking
// - createdFromIp/updatedFromIp: IP tracking
use Tourze\DeliveryAddressBundle\Repository\DeliveryAddressRepository;
// Query by user object
$qb = $repository->buildListQueryByUser($user);
// Query by user identifier (uses UserInterface::getUserIdentifier())
$qb = $repository->buildListQueryByUserId('user123');
// Find default address
$address = $repository->findDefaultByUser($user);
$address = $repository->findDefaultByUserId('user123');
// Unset default for user
$affectedRows = $repository->unsetDefaultForUser($user);
bash
php bin/console doctrine:migrations:diff
php bin/console doctrine:migrations:migrate
bash
# PHPStan static analysis (Level 9)
php -d memory_limit=2G ./vendor/bin/phpstan analyse packages/delivery-address-bundle/src --level=9