algos crm.
CRM Documentation
The same product docs available in the dashboard—guides for setup, architecture, modules, and day-to-day use.
Development · Coding Standards
Coding standards
Conventions for PHP/Laravel work in this CRM.
Style
- Use Laravel Pint (default Laravel preset; no custom
pint.jsonin repo). - Run before commit:
vendor/bin/pint
CI should use vendor/bin/pint --test (Recommended — see CI/CD).
PHP / Laravel
- PHP 8.2+ features are fine (enums, readonly DTOs already used in Channels).
- Prefer constructor property promotion and explicit return types on new code.
- Keep controllers thin; put domain logic in
app/Services. - Use Form Requests for non-trivial validation.
- Authorize via policies /
$this->authorize/@can/ permission middleware.
Tenancy rules
- Models with tenant data should use
BelongsToCompany. - Do not bypass
CompanyScopeunless required (webhooks, Super Admin tools). - After
withoutCompanyScope()lookups, setCurrentCompanybefore tenant writes. - Never trust client-provided
company_idfor authz.
RBAC rules
- New abilities →
config/permissions.phpthenphp artisan permissions:sync. - Slugs are
{action}.{module}. - Update
RbacSeederdefaults when a permission should ship tosales/admin. - Cover allow + deny in Feature tests.
Channels rules
- New providers need an adapter implementing
ChannelAdapterand registration inChannelServiceProvider. - Listing a key in
config/channels.phpalone only exposes UI — mark docs as Planned until registered. - Webhook HTTP handlers must stay fast; enqueue work on
channels. - Store secrets encrypted on
channel_connections.
Testing
- PHPUnit 11 (
tests/Unit,tests/Feature). - Prefer Feature tests for HTTP + tenancy + permissions.
- Fake HTTP for Meta Graph (
Http::fake). Queue::fake()when asserting dispatch without processing.
php artisan test
# or
composer test
Comments
- Do not narrate obvious code.
- Comment only non-obvious constraints (Meta quirks, tenancy escape hatches, migration MySQL limits).