antwebes/chatea-client-bundle
Installation:
AppKernel.php:
new Ant\Bundle\ChateaClientBundle\ChateaClientBundle(),
new Ant\Bundle\ChateaSecureBundle\ChateaSecureBundle()
config/routing.yml:
antwebes_chateclient:
resource: '@ChateaClientBundle/Resources/config/routing.xml'
prefix: /
Configuration:
config/config.yml:
chatea_secure:
app_auth:
client_id: %chatea_client_id%
secret: %chatea_secret_id%
enviroment: %chatea_enviroment%
api_endpoint: %api_endpoint%
chatea_client:
app_auth:
client_id: %chatea_client_id%
secret: %chatea_secret_id%
api_endpoint: %api_endpoint%
app_id: %chatea_app_id%
authenticate_client_as_guest: false
Security:
security.yml:
firewalls:
secured_area:
antwebs_chateaclient_login:
check_path: _security_check
login_path: _antwebes_chateaclient_login
provider: antwebs_chateaclient_provider
First Use Case:
@APIUser annotation to authenticate API calls with the logged-in user:
use Ant\Bundle\ChateaClientBundle\Security\Authentication\Annotation\APIUser;
class UserController {
/**
* @APIUser
*/
public function updateProfileAction() {
// API calls here will use the logged-in user's token
}
}
Default Behavior:
@APIUser to switch to user-specific authentication.Class-Level Annotation:
@APIUser at the class level to enforce user authentication for all methods:
/**
* @APIUser
*/
class RestrictedController {
// All methods here use user-specific auth
}
Guest Authentication:
authenticate_client_as_guest: true in config to authenticate as a guest user.Profile Management:
UserManager to fetch/update user profiles:
$userManager = $this->get('chatea_client.user_manager');
$user = $userManager->findById($userId);
Photo Handling:
PhotoManager:
$photoManager = $this->get('chatea_client.photo_manager');
$photoManager->updatePhoto($userId, $file);
Search Users:
$userManager->searchUserByNamePaginated('query', 1, 10);
Channels:
$channelManager = $this->get('chatea_client.channel_manager');
$channelManager->addFanToChannel($channelId, $userId);
Twig Globals:
twig:
globals:
boilerplate_users_base_url: http://yourdomain.com/users
boilerplate_channels_base_url: http://yourdomain.com/channels
Redirects:
firewalls:
secured_area:
default_target_path: chatea_client_welcome
always_use_default_target_path: true
Notifications:
$this->get('chatea_client.notification_manager')->checkProfileCompletion($userId);
Deprecated Methods:
UserController::confirmedAction is deprecated (use token-based auth instead).Photo Uploads:
if ($file->getSize() > 1048576) {
throw new \RuntimeException('Photo exceeds 1MB limit.');
}
Country/City Fields:
<select name="country" required>
{% for country in countries %}
<option value="{{ country.id }}">{{ country.name }}</option>
{% endfor %}
</select>
Guest Authentication:
authenticate_client_as_guest: true, API calls bypass user-specific auth. Verify this is intentional.Token Refresh:
@APIUser to handle it automatically.API Errors:
executeAndHandleApiException to catch malformed responses:
$result = $manager->executeAndHandleApiException(function() use ($manager) {
return $manager->findById($userId);
});
Profile Completion:
gender, about):
$profileManager->isProfileEmpty($userId, ['gender', 'about']);
Routing Issues:
routing.xml is properly included. Test routes with:
php bin/console debug:router | grep chatea
Custom Templates:
register.html.twig) in your theme directory. Key templates:
ChateaClientBundle:Registration:registerChateaClientBundle:Profile:editEvent Listeners:
AuthTokenUpdaterListener to customize token handling:
services:
app.chatea_token_listener:
class: AppBundle\EventListener\CustomTokenListener
tags:
- { name: kernel.event_listener, event: kernel.controller, method: onKernelController }
Validation:
$constraint = new \Symfony\Component\Validator\Constraints\Callback([
'callback' => [$this, 'validateUsername']
]);
$builder->add('username', $constraint);
Analytics:
analytics.js integration:
// Example: Track photo uploads
analytics.track('photo_uploaded', { userId: user.id });
Environment Variables:
parameters:
chatea_client_id: %env(CHATEA_CLIENT_ID)%
chatea_secret_id: %env(CHATEA_SECRET_ID)%
Recaptcha:
beelab_recaptcha2 is configured if using CAPTCHA:
beelab_recaptcha2:
site_key: %recaptcha_public_key%
secret: %recaptcha_private_key%
enabled: true
Countries File:
chatea_client:
countries_file: %kernel.root_dir%/config/countries.json
Visits Limit:
chatea_client:
visits_limit: 5 # Default: 3
Pagination:
$users = $userManager->searchUserByNamePaginated('query', $page, $limit);
Caching:
$cache = $this->get('chatea_client.cache');
$user = $cache->get("user_{$userId}", function() use ($userId) {
return $userManager->findById($userId);
});
Batch Operations:
findAll method with filters:
$users = $userManager->findAll(['filter' => 'active']);
How can I help you explore Laravel packages today?