Download the PHP package morningtrain/economic without Composer

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

PHP SDK for E-conomic

Latest Version on Packagist Tests Total Downloads

Installation

You can install the package via composer:

Basic Concepts

This SDK is built to make it simple to handle and use the e-conomic REST API. You can read the e-conomic REST API documentation here: https://restdocs.e-conomic.com/

Driver

The SDK uses a driver to handle the communication with the e-conomic REST API. We have not implemented a driver in this package, since we want to make it possible to use the SDK with different frameworks.

You are free to use some of our implementations, or make your own driver:

Framework Git Repo Composer Package
Laravel Morning-Train/laravel-economic morningtrain/laravel-economic
WordPress Morning-Train/wp-economic morningtrain/wp-economic

If you make your own driver, you must implement the Morningtrain\Economic\Interfaces\EconomicDriver interface, and initialize the API like this:

Loggers

We have implemented a PSR logger interface, so you can log all the requests and responses from the e-conomic REST API.

You can register a PSR logger by calling the registerLogger method on the Morningtrain\Economic\Services\EconomicLoggerService class.

Resources

Every resource in the e-conomic REST API is represented by a class in this SDK. The resources are located in the src/Resources folder.

Some resources are divided into sub resources based on the REST API.

Every resource class is implementing function corresponding to the endpoints in the API.

Some resources are just a DTO (Data Transfer Object) that is not represented with endpoints in the REST API. These resources are used to make it easy to work with objects represented in other Resources.

Collections

Collections are used to fetch multiple resources from the e-conomic REST API. We make use of Laravels lazy collections to make it easy to work with the collection. This means, that you can use all the methods from the Laravel collection class on the collections returned from the SDK. The lazy collection will automatically get the resources you need and handle pagination for you. The API is only called when you need the resources, so the collection will not contain data before you need it.

Filtering

When fetching resources from the e-conomic REST API, you can filter the resources you want to get, if the endpoint allows it. See https://restdocs.e-conomic.com/#endpoints for more information about which filters every resource support. The SDK has a simple way to filter resources, using af query builder like syntax.

A simple example could be:

Sorting

Is not yet implemented.

Usage

Every resource in the e-conomic REST API is represented by a class in this SDK. And every class is implementing function corresponding to the endpoints in the API.

Get multiple resources

When fetching multiple resources from the e-conomic REST API, you will get a collection of the resources. The collection is an implementation of the Laravel lazy collection, so you can use all the methods from the Laravel collection class on the collection.

To get multiple resources from the e-conomic REST API, you can use the all method on the resource class.

Filtering

You can filter the resources you want to get, if the endpoint allows it. See https://restdocs.e-conomic.com/#endpoints for more information about which filters every resource support. This will return af collection of resources matching the filter.

Get a single resource

When fetching a single resource from the e-conomic REST API, you will get an instance of the resource class you are asking for.

To get a single resource from the e-conomic REST API, you can use the find method on the resource class. The find method is using the primary key to find the resource. The primary key is different from resource to resource, so you need to look in the e-conomic REST API documentation to find the primary key for the resource you want to get. The type of primary key is mixed, so you can use a string or an integer to find the resource.

Creating a resource

Some resources can be created in E-conomic. When created succesfully you will get the resource you just created. We have implemented a create method on the resource class, so you can create a resource like this:

The parameters you need to provide when creating a resource is different from resource to resource, so you need to look in the implementation of the resource class to see which parameters you need to provide. Some parameter is required and some is optional. You can see which parameters are required and optional in the implementation of the resource class. To just use some of the optional parameters, you can use named parameters in PHP.

Some resources can be created in an alternative way with the new method. This will create a new instance of the resource class with the required properties. Some of these resources can then use the save method to create the resource in E-conomic.

Updating a resource

Some resources can be updated after creation. This can be done as follows:

This will update the customer name in E-conomic. You can also simply provide all the new values when instantiating the customer.

Deleting a resource

Some resources can be deleted in E-conomic. This can be done using the delete method on the resource class.

This will delete the customer in E-conomic.

You can also delete a resource by calling the static method deleteByPrimaryKey.

Examples

Get all customers

Get a single customer

Get a customer by email

Testing

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.


Developed by


Morningtrain logo

All versions of economic with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/support Version ^10.0|^11.0
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 morningtrain/economic contains the following files

Loading the files please wait ....