For sending LaTeX files to a compile server using the "Common LaTeX Service Interface"-API.
This library creates psr7-compatible http requests, so you can use any psr7-compatible http client for sending the created requests. You may take a look here for finding an http client.
For a CLSI server implementation see https://github.com/sharelatex/clsi-sharelatex
For the guzzle http client there is the GuzzleCompileRequestSender class included. It takes care of transforming the CompileRequest into an http request and also transforming the http response back into a CompileResponse.
You will need to require the suggested guzzlehttp/guzzle composer package.
require__DIR__.'/vendor/autoload.php'; useKaiwa\ClsiasClsi; $compileRequest = newClsi\Request\CompileRequest( 'http://myclsiserver.com:3013', 'myprojectId', newClsi\Request\Resource\TextFileResource(__DIR__.'/test.tex') ); // Optional: Add more resources// $compileRequest->addResources(// new Clsi\Request\Resource\UrlResource('logo.png', 'http://myserver.com/logo.png')// );$sender = newClsi\Bridge\Guzzle\GuzzleCompileRequestSender(); $compileResponse = $sender->send($compileRequest); $compiledPdfUrl = $compileResponse->getOutputFile('pdf');If you want to use any other psr7-compatible http client (or a particular Guzzle instance) you have to transform the CompileRequest into an http request and the http response into a CompileResponse manually.
require__DIR__.'/vendor/autoload.php'; useKaiwa\ClsiasClsi; $compileRequest = newClsi\Request\CompileRequest( 'http://myclsiserver.com:3013', 'myprojectId', newClsi\Request\Resource\TextFileResource(__DIR__.'/test.tex') ); // Optional: Add more resources// $compileRequest->addResources(// new Clsi\Request\Resource\UrlResource('logo.png', 'http://myserver.com/logo.png')// );$compileRequestFactory = newClsi\Psr\PsrCompileRequestFactory(); $compileResponseFactory = newClsi\Psr\PsrCompileResponseFactory(); // initiate your http client$httpClient = newHttpClient(); // Transform the CompileRequest into an http request$httpRequest = $compileRequestFactory->makePsrRequest($compileRequest); // Send the http request with your client and get the response$httpResponse = $httpClient->send($httpRequest); // Transform the http response into a CompileResponse$compileResponse = $compileResponseFactory->makeCompileResponse($httpResponse); // Work with the CompileResponse$compiledPdfUrl = $compileResponse->getOutputFile('pdf');