laravel-erp-crm maintained by jeffersongoncalves

Laravel ERP CRM
ERP CRM — leads, opportunities and campaigns for the Laravel ERP ecosystem.
This package is the CRM module of an ERPNext-native rebuild. It owns the pre-sales relationship documents (leads, opportunities, campaigns, contracts and appointments) and converts them into the downstream selling documents. It depends on jeffersongoncalves/laravel-erp-core and jeffersongoncalves/laravel-erp-selling.
Features
- CRM masters — Lead sources, campaigns and contracts (with party, signing status and contract terms).
- Leads — A relationship record with contact details and its own workflow status (
Lead → Open → Replied → Opportunity → Quotation → Converted, plusDo Not Contact), tied to a lead source and campaign. - Opportunities — A qualified deal with line items, amount, probability, type (
Sales,Support,Maintenance) and an ERPNext-style status (Open,Quotation,Converted,Lost,Closed,Replied). - Appointments — Scheduled meetings with a party and contact details.
- Conversion services —
LeadServicepromotes a lead into a selling Customer (flagging the leadConverted) or opens an Opportunity from it;OpportunityServiceturns an opportunity into a draft selling Quotation, copying every line. - Customizable Models — Override any model via config (ModelResolver pattern).
- Translations — English and Brazilian Portuguese.
Compatibility
| Package | PHP | Laravel |
|---|---|---|
^1.0 |
^8.2 |
^11.0 | ^12.0 | ^13.0 |
Installation
composer require jeffersongoncalves/laravel-erp-crm
Publish and run the migrations (the core and selling package migrations must be published too):
php artisan vendor:publish --tag="erp-core-migrations"
php artisan vendor:publish --tag="erp-selling-migrations"
php artisan vendor:publish --tag="erp-crm-migrations"
php artisan migrate
Publish the config (optional):
php artisan vendor:publish --tag="erp-crm-config"
Conversion
LeadService and OpportunityService are registered as singletons.
use JeffersonGoncalves\Erp\Crm\Services\LeadService;
use JeffersonGoncalves\Erp\Crm\Services\OpportunityService;
// Lead -> Customer (the lead is flagged Converted and linked to the new customer)
$customer = app(LeadService::class)->createCustomer($lead);
// Lead -> Opportunity (the lead moves to the Opportunity stage)
$opportunity = app(LeadService::class)->createOpportunity($lead);
// Opportunity -> Quotation (draft; the opportunity moves to the Quotation stage)
$quotation = app(OpportunityService::class)->createQuotation($opportunity);
- createCustomer instantiates the selling
Customerfrom the lead (using the company name when present), saves it, then links the lead back viacustomer_idand flags itConverted. - createOpportunity opens a CRM
Opportunityfrom the lead (opportunity_from = Lead) and moves the lead to theOpportunitystage. - createQuotation copies the party/company onto a draft selling
Quotationand copies every opportunity line into a quotation line, then moves the opportunity to theQuotationstage.
Database Tables
All tables use the configured prefix shared across the ERP ecosystem (default: erp_): lead_sources, campaigns, contracts, leads, opportunities, opportunity_items, appointments.
Testing
composer test
Changelog
Please see CHANGELOG for what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.