Download the PHP package whilesmart/eloquent-holdings without Composer
On this page you can find all versions of the php package whilesmart/eloquent-holdings. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download whilesmart/eloquent-holdings
More information about whilesmart/eloquent-holdings
Files in whilesmart/eloquent-holdings
Package eloquent-holdings
Short Description Polymorphic holdings register (crypto, stocks, property, any asset) for Laravel: track quantity and value, with pluggable live pricing.
License MIT
Informations about the package eloquent-holdings
whilesmart/eloquent-holdings
A polymorphic holdings register for Laravel: one model for anything you own and want to value, whether crypto, stocks, property, or collectibles. Each holding is scoped to an owner (a workspace, organization, user) through whilesmart/eloquent-owner-access, carries a quantity and a unit price, and can be priced by hand or refreshed automatically from a price provider you bind.
The package never hard codes a price source. It stores an opaque provider and external_ref, and asks a host-bound HoldingPriceProvider to resolve prices, so a CoinGecko, stock, or any other feed lives in your app, not here.
Install
Routes register automatically under the api prefix with auth:sanctum. Set HOLDINGS_REGISTER_ROUTES=false to mount them yourself.
Owning model
Add the trait to whatever owns holdings:
$holding->value returns quantity * unit_price in the holding's currency.
Live pricing
Implement HoldingPriceProvider in your app and bind it. The package groups auto-priced holdings by (provider, currency) and asks for current prices:
Refresh prices via the command (schedule it as you like) or the API:
A HoldingsRepriced event carries the ids of the holdings that changed, so the host can invalidate caches or recompute net worth.
Authorization
Records are owner-scoped. Bind an OwnerAuthorizer (see whilesmart/eloquent-owner-access) to decide who can see and modify each owner's holdings. Without one, the permissive default applies.
Endpoints
| Method | Path | Action |
|---|---|---|
| GET | /api/holdings |
List (owner-scoped; filter by owner_type/owner_id, price_source, q) |
| POST | /api/holdings |
Create |
| GET | /api/holdings/{holding} |
Show |
| PUT/PATCH | /api/holdings/{holding} |
Update |
| DELETE | /api/holdings/{holding} |
Delete (soft) |
| POST | /api/holdings/reprice |
Refresh auto-priced holdings |
Development
All versions of eloquent-holdings with dependencies
laravel/framework Version ^11.0|^12.0
whilesmart/eloquent-owner-access Version ^1.0