PHPackages                             tourze/freight-template-bundle - 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. [Templating &amp; Views](/categories/templating)
4. /
5. tourze/freight-template-bundle

ActiveSymfony-bundle[Templating &amp; Views](/categories/templating)

tourze/freight-template-bundle
==============================

0.0.1(5mo ago)00MITPHPCI passing

Since Nov 11Pushed 4mo agoCompare

[ Source](https://github.com/tourze/freight-template-bundle)[ Packagist](https://packagist.org/packages/tourze/freight-template-bundle)[ RSS](/packages/tourze-freight-template-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (40)Versions (2)Used By (0)

Freight Template Bundle
=======================

[](#freight-template-bundle)

[English](README.md) | [中文](README.zh-CN.md)

A Symfony bundle for managing freight templates in e-commerce applications. This bundle provides a complete solution for handling shipping cost calculations and template management.

Features
--------

[](#features)

- Freight template management with validation
- Multiple delivery types and valuation methods
- EasyAdmin integration for backend management
- Doctrine ORM integration with proper entity mapping
- RESTful API support
- Comprehensive validation and constraints
- Fixtures for development testing

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

[](#requirements)

- PHP 8.1+
- Symfony 6.4+
- Doctrine ORM
- EasyAdmin Bundle

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

[](#installation)

### Install the bundle

[](#install-the-bundle)

```
composer require tourze/freight-template-bundle
```

### Register the bundle

[](#register-the-bundle)

The bundle should be automatically registered by Symfony Flex. If not, add it to `config/bundles.php`:

```
return [
    // ...
    Tourze\FreightTemplateBundle\FreightTemplateBundle::class => ['all' => true],
];
```

### Run database migrations

[](#run-database-migrations)

```
php bin/console doctrine:migrations:diff
php bin/console doctrine:migrations:migrate
```

### Load demo fixtures (optional)

[](#load-demo-fixtures-optional)

```
php bin/console doctrine:fixtures:load --append --group=FreightTemplate
```

Usage
-----

[](#usage)

### Service Usage

[](#service-usage)

```
use Tourze\FreightTemplateBundle\Service\FreightTemplateService;

class YourService
{
    public function __construct(
        private FreightTemplateService $freightTemplateService
    ) {}

    public function calculateShipping(string $templateId): ?FreightTemplate
    {
        // Find freight template by ID
        return $this->freightTemplateService->findValidTemplateById($templateId);
    }

    public function getAvailableTemplates(): array
    {
        // Get all valid freight templates
        return $this->freightTemplateService->findAllValidTemplates();
    }
}
```

### Entity Usage

[](#entity-usage)

```
use Tourze\FreightTemplateBundle\Entity\FreightTemplate;
use Tourze\FreightTemplateBundle\Enum\FreightValuationType;
use Tourze\ProductCoreBundle\Enum\DeliveryType;

$template = new FreightTemplate();
$template->setName('Standard Shipping');
$template->setDeliveryType(DeliveryType::EXPRESS);
$template->setValuationType(FreightValuationType::FIXED);
$template->setCurrency('CNY');
$template->setFee('15.00');
$template->setValid(true);
```

API Reference
-------------

[](#api-reference)

### FreightTemplateService

[](#freighttemplateservice)

MethodParametersReturn TypeDescription`findValidTemplateById()``string $templateId``?FreightTemplate`Find valid template by ID`findAllValidTemplates()`-`array`Get all valid templates`findTemplatesBySpuIds()``array $spuIds``array`Find templates by SPU IDs### FreightTemplate Entity

[](#freighttemplate-entity)

#### Main Properties

[](#main-properties)

- `id`: string - Unique identifier (Snowflake ID)
- `name`: string - Template name
- `deliveryType`: DeliveryType - Delivery method
- `valuationType`: FreightValuationType - Valuation method
- `currency`: string - Currency code (default: CNY)
- `fee`: string - Shipping fee
- `valid`: bool - Whether template is active
- `sortNumber`: int - Sort order
- `createTime`: DateTime - Creation timestamp
- `updateTime`: DateTime - Last update timestamp

#### Enums

[](#enums)

**DeliveryType (配送方式)**

- `EXPRESS` - Express delivery
- `PICKUP` - Self pickup
- `STANDARD` - Standard delivery
- `ECONOMY` - Economy delivery

**FreightValuationType (计费方式)**

- `FIXED` - Fixed fee
- `BY_ITEM` - Per item billing

Admin Interface
---------------

[](#admin-interface)

Access the freight template management interface at `/admin/product/freight-template`:

- Create and edit freight templates
- Configure delivery types and valuation methods
- Manage template validity and sorting
- Filter and search templates

Testing
-------

[](#testing)

```
# Run all tests
./vendor/bin/phpunit packages/freight-template-bundle/tests

# Run PHPStan analysis
php -d memory_limit=2G ./vendor/bin/phpstan analyse packages/freight-template-bundle
```

Dependencies
------------

[](#dependencies)

- `tourze/product-core-bundle` - Core product functionality
- `tourze/doctrine-*-bundle` - Doctrine integration bundles
- `easycorp/easyadmin-bundle` - Admin interface
- `tourze/easy-admin-enum-field-bundle` - Enum field support for EasyAdmin

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

[](#configuration)

The bundle works out of the box with minimal configuration. However, you can customize certain aspects:

```
# config/packages/freight_template.yaml
freight_template:
    default_currency: 'CNY'
    default_valuation_type: 'fixed'
```

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

[](#contributing)

1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Add tests for new functionality
5. Run the test suite
6. Submit a pull request

License
-------

[](#license)

MIT License

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance77

Regular maintenance activity

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity24

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

Unknown

Total

1

Last Release

178d ago

### Community

Maintainers

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

---

Top Contributors

[![tourze](https://avatars.githubusercontent.com/u/13899502?v=4)](https://github.com/tourze "tourze (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/tourze-freight-template-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/tourze-freight-template-bundle/health.svg)](https://phpackages.com/packages/tourze-freight-template-bundle)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M647](/packages/sylius-sylius)[contao/core-bundle

Contao Open Source CMS

1231.6M2.3k](/packages/contao-core-bundle)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

7310.3k29](/packages/open-dxp-opendxp)

PHPackages © 2026

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