julio101290 / boilerplateservicelayer
A CodeIgniter 4 boilerplate repository for building a service layer to integrate with SAP Business One. It includes pre-built CRUD functionality for products and companies, with features for inventory management, invoice generation (with SAT fields), and user authorization.
Requires
- php: ^7.3 || ^8.0
- codeigniter4/framework: ^4.1
- codeigniter4/translations: ^4.0
- julio101290/auth: ^1.0
- julio101290/boilerplate: ^1.0
- julio101290/boilerplatecompanies: ^1.0.0
- julio101290/boilerplatelog: ^1.0.0
- tecnickcom/tcpdf: ^6.7
Requires (Dev)
- fakerphp/faker: ^1.13
- phpunit/phpunit: ^9.1
This package is auto-updated.
Last update: 2025-09-15 18:56:33 UTC
README
CodeIgniter 4 Boilerplate Service Layer CFDI V4.0
CodeIgniter4 Boilerplate Service Layer provides a CRUD MVC for managing SAP Service Layer connections per company.
It includes description, URL, port, credentials, and company database fields.
This module integrates with other boilerplates (Companies, BranchOffice, Log) to centralize Service Layer configuration.
Requirements
- PhpCfdi\SatCatalogos
- julio101290/boilerplatelog
- julio101290/boilerplatecompanies
- julio101290/boilerplatebranchoffice
Installation
Run composer commands
composer require phpcfdi/sat-catalogos composer require julio101290/boilerplatelog composer require julio101290/boilerplatecompanies composer require julio101290/boilerplatebranchoffice composer require julio101290/boilerplateservicelayer
Run migrations and seeders
php spark boilerplatecompanies:installcompaniescrud php spark boilerplatelog:installlog php spark boilerplatebranchoffice:installbranchoffice php spark boilerplateservicelayer:installservicelayer
BaseController.php Configuration
Add the SAT Catalogs Factory and configure global variables with SQLite DSN:
<?php namespace App\Controllers; use CodeIgniter\Controller; use CodeIgniter\HTTP\CLIRequest; use CodeIgniter\HTTP\IncomingRequest; use CodeIgniter\HTTP\RequestInterface; use CodeIgniter\HTTP\ResponseInterface; use Psr\Log\LoggerInterface; // ADD use PhpCfdi\SatCatalogos\Factory; abstract class BaseController extends Controller { protected $request; protected $helpers = []; public $catalogosSAT; public $unidadesSAT; public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger) { parent::initController($request, $response, $logger); date_default_timezone_set("America/Mazatlan"); // ADD $dsn = "sqlite:".ROOTPATH."writable/database/catalogossat.db"; $factory = new Factory(); $satCatalogos = $factory->catalogosFromDsn($dsn); $this->catalogosSAT = $satCatalogos; } }
SAT Catalog Database
- Download and uncompress the file:
https://github.com/phpcfdi/resources-sat-catalogs/releases/latest/download/catalogs.db.bz2 - Place it in:
writable/database/catalogossat.db
Service Layer Menu Example
Ready to Use
Usage
Explore the code in routes, controllers, and views to understand how it works.
Finally... Happy Coding!
Changelog
Please see CHANGELOG for more details about recent changes.
Contributing
Contributions are welcome and greatly appreciated.
License
This package is free software distributed under the terms of the MIT license.