Download the PHP package jimeneztdavid/scaled-int-laravel without Composer

On this page you can find all versions of the php package jimeneztdavid/scaled-int-laravel. 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 scaled-int-laravel

ScaledInt Laravel

Laravel integration for jimeneztdavid/scaled-int.

Why this package exists

ScaledInt solves a common problem in money and decimal-based attributes: databases store exact integers, while applications often need values such as 10.25, 2.750, or similar scaled numbers.

This package bridges that gap for Laravel. It lets you work with readable major values in your models while storing the minor integer representation in the database. That keeps arithmetic exact, avoids floating-point errors, and keeps Eloquent attributes simple to use.

The package also provides an Artisan command to add the cast to a model automatically.

Installation

Why this package exists in practice

Float math is not reliable for exact values

That is fine for approximate scientific calculations, but not for money, discounts, taxes, or any value that must round exactly.

Storing money as a float creates long-term problems

If you store a price as a float, you are asking the database and PHP to preserve decimal precision that binary floats do not represent cleanly.

Common Laravel workaround:

This works, but it means every model repeats the same logic. It also pushes rounding decisions into many places instead of one.

Comparisons with floats can be misleading

With scaled integers, the comparison is exact because the stored value is an integer.

The same problem appears when saving and loading values

Many projects end up doing this manually:

That means multiplying by 100 on write, dividing by 100 on read, and keeping the column as an integer. ScaledIntCast does that for you in one place.

What you get with ScaledInt

Usage

Model cast

What the cast does

Example with data

ScaledInt methods

The jimeneztdavid/scaled-int package provides a value object with safe decimal arithmetic.

Creating values

Reading values

Arithmetic

Comparisons

Accepted assignment values

Supported usage patterns

Artisan command

Options:

The command supports both existing casts(): array methods and legacy $casts properties.

Configuration

Configuration options:


All versions of scaled-int-laravel with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
illuminate/console Version ^12.0|^13.0
illuminate/database Version ^12.0|^13.0
illuminate/support Version ^12.0|^13.0
jimeneztdavid/scaled-int Version ^1.2
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 jimeneztdavid/scaled-int-laravel contains the following files

Loading the files please wait ...