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.

dev-main 2025-09-15 18:30 UTC

This package is auto-updated.

Last update: 2025-09-15 18:56:33 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License

thumbnail

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

Service Layer Menu Example

image

Ready to Use

image

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.