PHP code example of swisscom / aliceconnector

1. Go to this page and download the library: Download swisscom/aliceconnector 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/ */

    

swisscom / aliceconnector example snippets



namespace Your\Package\Tests\Functional;

use Swisscom\AliceConnector\Context;
use Neos\Flow\Tests\FunctionalTestCase;

class CompanyTest extends FunctionalTestCase
{

    /**
     * @var Context
     */
    protected $fixtureContext;

    public function setUp(): void
    {
        parent::setUp();
        $this->fixtureContext = new Context($this->objectManager, $this::$testablePersistenceEnabled);
    }
    
    /**
     * @test
     */
    public function companyTest()
    {
        $fixtures = $this->fixtureContext->loadFixture('Company');
        $company = $fixtures['company1'];
        self::assertSame('Swisscom', $company->getName());
    }
}

$companyRepository = $this->objectManager->get(CompanyRepository::class);
$company = $companyRepository->findOneByName('Swisscom');

$collection = $faker->arrayCollection([$item1, $item2]);

$resource = $faker->persistentResource('Dummy.txt');

$image = $faker->persistentResourceImage('Dummy.png');

$document = $faker->persistentResourceDocument('Dummy.pdf');

$string = $faker->fileContent('Dummy.txt');

$image = $faker->hashPassword('12345678');

$image = $faker->role('Your.Package:User');