1. Go to this page and download the library: Download serwersms/serwersmsbundle 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/ */
serwersms / serwersmsbundle example snippets
namespace App\Controller;
use SerwerSMS\SerwerSMSBundle\SerwerSMSInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Routing\Attribute\Route;
class SmsController extends AbstractController
{
public function __construct(private SerwerSMSInterface $serwerSms)
{
}
#[Route('/send-sms')]
public function sendSms(): JsonResponse
{
try {
$result = $this->serwerSms->messages()->sendSms(
[
'+48500600700',
'+48600700800'
],
'Test FULL message',
'INFORMACJA',
[
'test' => true,
'details' => true
]
);
return new JsonResponse($result);
} catch (\Exception $e) {
return new JsonResponse(['error' => $e->getMessage()], 500);
}
}
}