PHP code example of ricorocks-digital-agency / soap

1. Go to this page and download the library: Download ricorocks-digital-agency/soap library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ricorocks-digital-agency / soap example snippets


use RicorocksDigitalAgency\Soap\Facades\Soap

Soap::to()

Soap::to('...')->withHeaders(...$headers)->call('...');

$header = Soap::header()
            ->name('Authentication')
            ->namespace('test.com')
            ->data([
                'user' => '...',
                'password' => '...'
            ])
            ->mustUnderstand()
            ->actor('foo.co.uk')

$header = Soap::header('Authentication', 'test.com', [
                'user' => '...',
                'password' => '...'
            ])
            ->mustUnderstand()
            ->actor('foo.co.uk')

$header = soap_header('Authentication', 'test.com')
            ->data([
                'user' => '...',
                'password' => '...'
            ])

Soap::headers(...$headers)

// Only requests to this endpoint will t.com'))->for('https://api.example.com');

// Only requests to this endpoint and the method Customers will 

Soap::to('github.com/api')

Soap::to('github.com/api')->functions()

Soap::to('github.com/api')->call('merge')

Soap::to('github.com/api')->merge()

Soap::to('github.com/api')->call('merge', ['branch' => 'staging', 'credentials' => ['password' => '...'])

'PullRequest' => [
    '_' => '',
    'branch' => 'dev',
    'target' => 'main'
]

'PullRequest' => [
    'Author' => 'Ricorocks',
    'branch' => 'dev',
    'target' => 'main'
]

Soap::to('...')
    ->information('PullRequest' => soap_node(['branch' => 'dev', 'target' => 'main']))

'PullRequest' => [
    '_' => '',
    'branch' => 'dev',
    'target' => 'main'
]

Soap::to('...')
    ->information('PullRequest' => soap_node(['branch' => 'dev', 'target' => 'main'])->body(['Author' => 'Ricorocks']))

'PullRequest' => [
    'Author' => 'Ricorocks',
    'branch' => 'dev',
    'target' => 'main'
]

Soap::to('...')->withOptions(['soap_version' => SOAP_1_2])->call('...');

Soap::trace()

Soap::to('...')->trace()->call('...')

Soap::to('...')->withBasicAuth('username', 'password')->call('...');
Soap::to('...')->withDigestAuth('username', 'password')->call('...');

// Every request will ' => 'foo', 'password' => 'bar']);

// Only requests to this endpoint will word' => 'bar'])->for('https://api.example.com');

// Only requests to this endpoint and the method Customers will word' => 'bar'])->for('https://api.example.com', 'Customers');

Soap::to('http://example.com')
	->beforeRequesting(fn() => Log::info('Request going in!'))
	->afterRequesting(fn() => Log::info('Request coming out!'))
	->call('Action', []);

Soap::beforeRequesting(fn() => Log::info('Request going in!'));
Soap::afterRequesting(fn() => Log::info('Request coming out!'));

Soap::fake(['http://endpoint.com' => Response::new(['foo' => 'bar'])]);

Soap::fake(['http://endpoint.com:Details' => Response::new(['foo' => 'bar'])]);

Soap::fake(['http://endpoint.com:Details|Information|Overview' => Response::new(['foo' => 'bar'])]);

Soap::

Soap::

// Only requests to https://api.example.com will ' => '...', 'password' => '...'])])->for('https://api.example.com');

// Only requests to https://api.example.com calling the Customers method will ' => '...', 'password' => '...'])])->for('https://api.example.com', 'Customers');