Download the PHP package ricorocks-digital-agency/soap without Composer

On this page you can find all versions of the php package ricorocks-digital-agency/soap. 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 soap

Soap

Tests

A Laravel SOAP client that provides a clean interface for handling requests and responses.

Docs

Requirements

Installation

You can install the package via composer

Note: As of v1.5.0 Soap requires PHP ^7.4

Using Soap

Soap can be accessed through the provided Facade

Features/API

Headers

You can set the headers for each soap request that will be passed to the Soap Client using the withHeaders method.

Each header should be a Header instance, which provides a fluent interface for constructing a new PHP Soap Header and can be composed as follows:

This can also be expressed as:

Plus, the soap_header helper method can be used:

The data for the header can either be an array or a SoapVar, as per the SoapHeader constructor

Global Headers

Soap allows you to set headers that should be included for every request:

Again, each header should be an instance of Header.

You may also want to include headers on every request, but only for a certain endpoint or action:

These calls are usually placed in the boot method of one of your application's Service Providers.

To

The endpoint to be accessed

Functions

Retrieve the functions the endpoint provides

This is a wrapper for the PHP SoapClient _getFunctions() method.

Call

Call the method at the endpoint.

The method can also be called as a Magic Method.

Parameters

The Call method of course accepts parameters. The parameters passed can be an array

Nodes

To simplify dealing with SOAP XML in your requests, Soap provides a method to fluently construct the nodes in the request.

For example, say the following node was desired in the XML request. Note it has no body.

The array to pass to the underlying php SoapClient to construct this node would be as follows

The _ is required to set the information not as the body, but as the attributes for the node.

However, this is not required if the XML node has a body.

Now, the array would be as follows

So, to prevent confusion, the Soap::node() will allow for intelligent construction of the php array to be passed to SoapClient.

Imagine we are accessing the information method to see details about Pull Requests

Now, just by adding or removing a body to the soap_node() the outputted array is intelligently constructed.

A node can be made with either the Facade Soap::node() or the helper method soap_node().

Options

You can set custom options for each soap request that will be passed to the Soap Client using the withOptions method.

See https://www.php.net/manual/en/soapclient.construct.php for more details and available options.

Soap also provides a number of methods that add syntactical sugar to the most commonly used options, which are detailed below.

Tracing

Soap allows you to easily trace your interactions with the SOAP endpoint being accessed.

To trace all requests, set the following in the register method of your ServiceProvider:

Now, all Response objects returned will have a Trace object attached, accessible via $response->getTrace(). This has four properties which are wrappers for the respective methods found on the SoapClient:

Tracing can also be declared locally:

Now, just this Response will have a valid Trace.

Tracing is null safe. If $response->getTrace() is called when a Trace hasn't been set, a new Trace is returned. This Trace's properties will all return null.

Authentication

You can authenticate using Basic or Digest by calling withBasicAuth and withDigestAuth respectively.

Global Options

Sometimes, you may wish to include the same set of options on every SOAP request. You can do that using the options method on the Soap facade:

You may also want to include options on every request, but only for a certain endpoint or action:

These calls are usually placed in the boot method of one of your application's Service Providers.

Hooks

Hooks allow you to perform actions before and after Soap makes a request. These hooks can be local (per request), or global (applied to every request).

You can make changes to the Request object in beforeRequesting hooks if you wish. These changes will be reflected in the actual request. In fact, this is how the Soap include functionality works.

Local

To create a local hook, chain beforeRequesting or afterRequesting to a Request object:

Any before requesting hooks will receive the request as a parameter and after requesting hooks will receive the request and response as a parameter.

Global

To create a global hook, use the Soap::beforeRequesting and Soap::afterRequesting methods.

Any before requesting hooks will receive the request as a parameter and after requesting hooks will receive the request and response as a parameter.

Faking

Soap includes full support for faking endpoints and actions, as well as inspecting requests and responses.

To fake all SOAP requests, call Soap:fake(). This will return an empty response for every request. It is likely that you will want to be more specific, so you can pass the fake method an array of endpoints as keys and response objects as values:

In the above example, any SOAP request made to http://endpoint.com will be faked, and a Response object with a body of ['foo' => 'bar'] will be returned instead.

What if you want to specify the SOAP action too? Easy! Just add :{ActionName} after your endpoint, like so:

Now, only SOAP requests to the Details actions will be mocked.

You can also specify multiple actions with the | operator:

Now, only SOAP requests to the Details, Information and Overview actions will be mocked.

Inspecting requests

If you've made a call to Soap::fake(), Soap will record all requests made. You can then inspect these requests as you see fit.

Soap::assertSentCount($count)

If you just want to assert that n amount of SOAP requests were sent, you can use this method, passing in the desired count as a parameter.

Soap::assertSent(callable $callback)

You can dive a little deeper and test that a particular request was actually sent, and that it returned the expected response. You should pass a closure into this method, which receives the $request and $response as parameters, and return true if they match your expectations.

Soap::assertNotSent(callable $callback)

This is the opposite of Soap::assertSent. You can make sure that a particular request wasn't made. Again, returning true from the closure will cause it to pass.

Soap::assertNothingSent()

If you just want to make sure that absolutely nothing was sent out, you can call this. It does what it says on the tin.

Configuration

Configuration of Soap is via the Soap facade in the boot() method in your service provider.

Include

Parameters can be set to be automatically included in all requests. These can be arrays or nodes

You can even use dot syntax on your array keys to permeate deeper into the request body.

Often, you'll want to target specific endpoints or actions. You can chain the for method to achieve this.

Ray Support

This package comes with first party support for Ray, an awesome debugging tool by Spatie! We offer a couple of methods that you can use to start debugging immediately.

Obviously, you'll need Ray installed in your project for this to work.

ray()->showSoapRequests()

This enables Ray support in the SOAP package. Any SOAP requests made will be recorded in the Ray app for you to inspect.

ray()->stopShowingSoapRequests()

This disables Ray support in the SOAP package. Requests will stop being recorded if previously enabled.

If you want to use the Ray integration inside of your tests, remember to register the RayServiceProvider along with your other providers.

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

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


All versions of soap with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1|^8.2|^8.3
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 ricorocks-digital-agency/soap contains the following files

Loading the files please wait ....