Skip to content

Victor-Fiamoncini/my_bar_decoder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

83 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

My Bar Decoder 🧾

  • Web application for decoding payment codes from PDF files using PHP and Laravel framework with Livewire. The main API used for decoding was Google Vision API V1 which has a free plan.
  • App designed to test the Cloud platform called Render and Laravel/Livewire FE library.
  • The app uses Resend to send emails without using SMTP protocol.
  • The app uses Cloudflare services for DNS management.

Required Tools

  • PHP v8.4.13
  • Composer v2.8.12
  • Laravel v12.43.1
  • Livewire v3.7.3
  • NodeJS v20.13.1

Required PHP v8 Extensions

  • pecl.php.net/imagick-3.8.1

Imagick Extension Setup (Debian)

# Install ImageMagick system libraries first
sudo apt-get update
sudo apt-get install libmagickwand-dev imagemagick ghostscript

# Install Imagick extension via PECL
pecl install imagick

# Find your PHP ini directory
php --ini

# Add the extension to your php.ini or create a new config file
echo "extension=imagick.so" >> $(php --ini | grep "Scan for additional" | awk '{print $NF}')/imagick.ini

# Check if the extension is loaded
php -m | grep imagick

Development Setup (Using Laravel Sail)

cp .env.example .env

# Create PostgreSQL and Laravel containers
sail up -d

# Run database migrations
sail artisan migrate

# Run Vite dev server
sail npm run dev

Architecture

The project follows a Clean Architecture approach with Domain-Driven Design (DDD) principles, separating business logic from framework dependencies and infrastructure concerns.

Core Namespace Structure

The \Core namespace is organized into distinct layers:

App\Core\
├── 📦 Domain\          # Business logic and entities
├── ⚙️ Application\     # Use cases and services
└── 🔌 Infrastructure\  # External dependencies and implementations

Domain Layer

Domain entities represent core business concepts with encapsulated business rules:

  • Immutability: Entities use readonly properties to ensure state consistency
  • Value Objects: Properties like PaymentCode::$code are protected to maintain invariants
  • Business Rules: Validation and behavior are encapsulated within entities

Example: PaymentCode entity enforces payment code format rules and provides typed access to its properties.

Application Layer

Application services/use-cases orchestrate domain entities and coordinate business workflows:

  • Single Responsibility: Each service handles one specific use case
  • Dependency Injection: Services depend on interfaces, not concrete implementations
  • Framework Agnostic: No direct Laravel dependencies in service logic

Infrastructure Layer

Concrete implementations of domain interfaces:

  • Database interactions (Eloquent models/repositories)
  • External API clients
  • OCR services (Google Vision API)

Released in 2025

By Victor B. Fiamoncini ☕️

Releases

No releases published

Packages

No packages published

Languages