Download the PHP package hejunjie/trade-splitter without Composer

On this page you can find all versions of the php package hejunjie/trade-splitter. 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 trade-splitter

PHP Trade Splitter

简体中文

A flexible and extensible trade/profit distribution component.
Built-in strategies include Percentage, Fixed Amount, Ladder, and Recursive, and you can easily register custom strategies.

Perfect for multi-level commissions, e-commerce settlements, platform fees, and agent profit sharing.

This project has been parsed by Zread. If you need a quick overview of the project, you can click here to view it:Understand this project


✨ Features


📦 Installation


🚀 Quick Start

Example output:


🧩 Core Concepts

Concept Description
Splitter The main entry point — selects the strategy and performs the split
StrategyInterface Contract every strategy must implement:split(SplitContext $context): array
SplitContext Contains the split context (totalandparticipants)
Allocation Represents a split result withname,amount, andratio; providestoArray()

🧮 Built-in Strategies

Percentage Split percentage

Distributes amounts by percentage. The sum of all rate values must equal 1.0.


Fixed Amount Split fixed

Splits by fixed amounts. The total of all fixed values must not exceed the total amount.


Ladder Split ladder

Applies different percentage rates based on amount tiers.
Use null for no upper limit.


Recursive Split recursive

Each level’s share is calculated based on the remaining amount from the previous level.
Useful for multi-tier agent or channel commission systems.


🧠 Custom Strategy

Implement the Hejunjie\TradeSplitter\Contracts\StrategyInterface and register it:


🧪 Run the Demo

A demo script is included in the repository:

This script demonstrates all four built-in strategies.


💡 Motivation

This component was born from my frustration with rigid, hard-coded profit-sharing logic in various projects.
I wanted a clear, pluggable, and reusable solution that could be integrated into any project — without reinventing the wheel each time.

If you’ve encountered strange or complex split scenarios in your business,
feel free to collaborate and help make this tool even more powerful!


🤝 Contributing

Got ideas, feedback, or found a bug? PRs and Issues are always welcome 🙌
If you find this project helpful, please consider giving it a ⭐ Star — that’s the biggest motivation for me to keep improving it!


All versions of trade-splitter with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
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 hejunjie/trade-splitter contains the following files

Loading the files please wait ...