1. Go to this page and download the library: Download bash/s365-content-bundle 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/ */
bash / s365-content-bundle example snippets
namespace App\Controller;
use Bash\S365ContentBundle\Infrastructure\HttpClient\ContentClient;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
class NewsController extends AbstractController
{
public function __construct(
private readonly ContentClient $contentClient
) {}
public function list(): Response
{
// No try-catch needed if you have a global ExceptionListener
$response = $this->contentClient->request('GET', 'articles?limit=10');
return new Response(
$response->getContent(),
$response->getStatusCode(),
['Content-Type' => 'application/json']
);
}
}
// Inside your service or controller
$correlationId = $request->headers->get('X-Correlation-ID');
$response = $this->contentClient->forward(
method: 'GET',
url: 'articles',
correlationId: $correlationId // The ID is now linked to S365 logs
);