Download the PHP package justbetter/laravel-dynamics-client without Composer

On this page you can find all versions of the php package justbetter/laravel-dynamics-client. 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 laravel-dynamics-client

Laravel Dynamics Client

This package will connect you to your Microsoft Dynamics web services via OData. Custom web services can easily be implemented and mapped to your liking. It uses the HTTP client of Laravel which means that you can easily fake requests when writing tests.

The way we interact with OData has been inspired by Laravel's Query Builder.

Installation

Install the composer package.

Setup

Publish the configuration of the package.

Configuration

Add your Dynamics credentials in the .env:

Be sure the DYNAMICS_PAGE_SIZE is set equally to the Max Page Size under OData Services in the configuration of Dynamics. This is crucial for the functionalities of the lazy method of the QueryBuilder.

Authentication

Note: Be sure that Dynamics has been properly configured for OData.

This package uses NTLM authentication by default. If you are required to use basic auth or OAuth you can change this in your .env.

OAuth

To setup OAuth add the following to your .env

When using D365 cloud with Microsoft identity platform your redirect uri will be: https://login.microsoftonline.com/<tenant>/oauth2/v2.0/token and your base url should be https://api.businesscentral.dynamics.com/v2.0/<tenant>/<environment>.

Connections

Multiple connections are supported. You can easily update your dynamics configuration to add as many connections as you wish.

By default, the client will use the company field to select the Dynamics company. If you wish to use the company's UUID you can simply add an uuid field:

Adding web services

Adding a web service to your configuration is easily done. Start by creating your own resource class to map te data to.

Primary Key

By default, the primary key of a resource will default to No as a string. You can override this by supplying the variable $primaryKey.

Data Casting

Fields in resources will by default be treated as a string. For some fields, like a line number, this should be casted to an integer.

Registering Your Resource

Lastly, you should register your resource in your configuration file to let the package know where the web service is located. This should correspond to the service name configured in Dynamics.

If your resource class name is the same as the service name, no manual configuration is needed.

Note: Make sure your web service is published.

Query Builder

Querying data is easily done using the QueryBuilder.

Using the get method will only return the first result page. If you wish to efficiently loop through all records, use lazy instead.

See the QueryBuilder class for all available methods.

Relations

Any relations published on a page can be accessed as well using the resource.

Note that the relation method itself returns an instance of a query builder. This means that you can add additional where-clauses like you would be able to on a regular resource.

Creating records

Create a new record.

Updating records

Update an existing record.

Deleting records

Delete a record.

Debugging

If you wish to review your query before you sent it, you may want to use the dd function on the builder.

Commands

You can run the following command to check if you can successfully connect to Dynamics.

Extending

If needed, it is possible to extend the provided ClientFactory class by creating your own. You must implement the ClientFactoryContract interface and its methods.

You will then need to bind your custom factory as the implementation of the contract, in any of your ServiceProvider register method :

Fake requests to Dynamics

When writing tests you may find yourself in the need of faking a request to Dynamics. Luckily, this packages uses the HTTP client of Laravel to make this very easy.

In order to fake all requests to Dynamics, you can call the method fake on any resource.

The fake method will fake all requests to Dynamics, not just the endpoint of the used resource.

This method will fake the Dynamics configuration and removes sensitive information like usernames and passwords. Only the company name will remain in order to easily test with multiple connections.

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.


All versions of laravel-dynamics-client with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
justbetter/odata-client Version ^1.3
laravel/framework 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 justbetter/laravel-dynamics-client contains the following files

Loading the files please wait ....