Download the PHP package condoedge/finance without Composer

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

condoedge/finance

Package Explanation

This package provides a comprehensive solution for managing financial transactions and products. Its main goal is to ensure data integrity and offer components for handling payment gateways, accounts, payment methods (extendable), invoices, accounting, taxes, and more.


Installation

1. Install the package using Composer

2. Run migrations

Create the necessary tables in your database:

3. Publish the configuration file

4. Seed configuration data

5. Seed test data (Optional)


Extendables

Customers

The customers table manages all financial customers in the application. This table should only contain financial fields. Other data should be managed through intermediary classes. A customer can be a team, person, or any other concept, but must implement the CustomableContract to be recognized as a customer. This allows duplicating fields like name, email, phone, and address for historical accuracy.

Use the CanBeFinancialCustomer trait to get contract methods already resolved.

Currencies

Currency configuration is dynamic and can be overridden using user or locale preferences.

Payment Gateways

The PaymentGateway facade manages payment methods. All payment methods are accessed through a single entry point, making it easy to extend. Default gateways include Stripe, PayPal, Cash, and Bank Transfer. The PaymentGatewayResolver uses the invoice context to select the correct gateway.


Ensuring Data Integrity

Data integrity is the most important aspect of financial software. This package uses several strategies to guarantee consistency:

1. Calculated Columns

2. Integrity Checking

There are two main ways to ensure data integrity:

The service responsible for this is Condoedge\Finance\Services\IntegrityChecker, which uses methods like checkChildrenThenModel(), checkModelThenParents(), and checkFullIntegrity().

For real-time updates after saving a model, the HasIntegrityCheck trait is used. It calls a static checkIntegrity() method on the model, updating the relevant data based on an editable method columnsIntegrityCalculations() that must be implemented in each model associating columns with their functions to calculate them.

Example:

Models using this trait include:

Search for @CALCULATED in the codebase to find these columns and their calculation logic.

3. Database Triggers

Triggers are used to:

Search for @TRIGGERED in the codebase to find these processes.


4. Component-Agnostic Logic through DTOs and Model Services

One of Kompo's strengths is its ability to automatically manage model saving within forms, which simplifies development. However, this approach has limitations:

  1. Logic Reuse Challenge: When business logic is defined in components, it becomes difficult to reuse across different contexts
  2. Validation Isolation: Validation rules defined at the component level cannot be easily abstracted or standardized
  3. Consistency Concerns: Ensuring the same validation and business rules apply in all contexts (UI forms, API, etc.) becomes challenging

Our solution uses a two-part architecture:

Static Model Methods as Services

Instead of keeping saving logic in components, we implement static methods on model classes (or their facades) that handle all business logic:

These methods act as services that encapsulate all business logic, data validation, and relationship management in one place, regardless of whether the data comes from a UI form or an API request.

Data Transfer Objects (DTOs)

We use the wendelladriel/laravel-validated-dto package to create strongly typed data containers that:

  1. Define the exact shape of data needed for each operation
  2. Implement validation rules in a single place
  3. Handle type casting automatically
  4. Provide clear contracts between UI/API and business logic

This approach allows both forms and API controllers to use the exact same validation and business logic:

Benefits

API

For apis documentation we use dedoc/scramble. It automatically generates a documentation using the dtos and some minor comments.

Process Explanations

Creating Invoices

Invoices use a system of positive and negative values to simplify balance calculations. The process is highly automated:

Creating Invoice Details

Note:
If you use the value before saving (before the integrity process runs), you might get an incorrect value. Always use values after saving or after running the integrity process.


Applying Payments

Payments involve two steps: creating the payment and applying it.


Safe Decimals

One of the most common problems in the programming language is the float type. We use a concept called "safe decimals" to avoid issues with float precision. To apply that concept we have a SafeDecimal class combined with the SafeDecimalCast class to handle the operations between decimals instead of using direct php operators.

For collection operations you have the following macros that will help to get the correct values working with decimals:

Also you have a helper function safeDecimal() that will help you to create a new instance of the SafeDecimal class.

safeDecimal accepts a float, string, integer or SafeDecimal instance for the construction and also the operations. It will return a new instance of SafeDecimal.

Precision

You can configure the scale/precision of the decimals in the config/kompo-finance.php file. By default, it is set to 5 decimals.

Testing decimals

Handling unmanaged decimals

Our first goal is not saving wrong data into the database. One problem must be if you add a new database column and you forget to apply the cast so you'll be doing operations out of the decimal type. This can cause problems in the future, especially if you use the value in a calculation. I created two approaches

Disabling the error

If you want to disable the error approach you can just add the SAFE_DECIMAL_DISABLE_HANDLER env variable to your .env file. This will ignore the unmanaged decimals and just log the case. By the default it will be disabled in prod but enabled in local and testing

Maintenance of integrity

Summary

For more details, search for @CALCULATED and @TRIGGERED in the codebase to find all automated and integrity-related processes.



All versions of finance with dependencies

PHP Build Version
Package Version
Requires php Version ^7.3|^8.0
laravel/framework Version >=5.6.0
kompo/auth Version >=0.4
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 condoedge/finance contains the following files

Loading the files please wait ....