feat: Implement SMS sending functionality with KavehNegar and Rangineh providers

- Add SendSmsMessage class for encapsulating SMS message data.
- Create KavehNegarProvider and RanginehProvider classes implementing SmsProviderInterface for sending SMS.
- Implement SmsLogRepository and SmsTemplateRepository for managing SMS logs and templates.
- Develop SendSmsHandler for handling SMS sending messages.
- Create SmsService to manage SMS dispatching and logging.
- Add UserProfileController for managing user profiles with CRUD operations.
- Implement UserProfile entity and repository for user profile data management.
- Update symfony.lock and bootstrap.php for project dependencies and environment setup.
This commit is contained in:
hamed
2026-06-09 22:00:34 +03:30
commit de1a78a235
222 changed files with 36388 additions and 0 deletions
+51
View File
@@ -0,0 +1,51 @@
<?php
namespace App\Shared\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
abstract class BaseController extends AbstractController
{
protected function success(mixed $data, int $status = 200, array $meta = []): JsonResponse
{
$response = ['success' => true, 'data' => $data];
if (!empty($meta)) {
$response['meta'] = $meta;
}
return new JsonResponse($response, $status);
}
protected function paginated(mixed $data, int $total, int $page, int $limit): JsonResponse
{
return $this->success($data, 200, [
'totalRecords' => $total,
'totalPages' => (int) ceil($total / max($limit, 1)),
'currentPage' => $page,
]);
}
protected function error(string $code, string $message, int $status = 400, ?string $field = null): JsonResponse
{
$err = ['code' => $code, 'message' => $message];
if ($field !== null) {
$err['field'] = $field;
}
return new JsonResponse(['success' => false, 'data' => null, 'errors' => [$err]], $status);
}
protected function validationError(array $violations): JsonResponse
{
$errors = [];
foreach ($violations as $field => $messages) {
foreach ((array) $messages as $message) {
$errors[] = [
'code' => 'ERR_VALIDATION_001',
'field' => $field,
'message' => $message,
];
}
}
return new JsonResponse(['success' => false, 'data' => null, 'errors' => $errors], 422);
}
}
@@ -0,0 +1,45 @@
<?php
namespace App\Shared\Controller;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Contracts\Cache\CacheInterface;
class HealthController
{
public function __construct(
private readonly EntityManagerInterface $em,
private readonly CacheInterface $cache,
) {}
#[Route('/health', methods: ['GET'])]
public function __invoke(): JsonResponse
{
$checks = [];
$status = 'ok';
try {
$this->em->getConnection()->executeQuery('SELECT 1');
$checks['database'] = 'ok';
} catch (\Throwable) {
$checks['database'] = 'error';
$status = 'degraded';
}
try {
$item = $this->cache->getItem('health_check');
$checks['redis'] = 'ok';
} catch (\Throwable) {
$checks['redis'] = 'error';
$status = 'degraded';
}
return new JsonResponse([
'status' => $status,
'checks' => $checks,
'timestamp' => time(),
], $status === 'ok' ? 200 : 503);
}
}