jn-devops/contacts

Homeful Contacts Package

Fund package maintenance!
Homeful

v2.1.19 2025-03-27 09:29 UTC

This package is auto-updated.

Last update: 2025-03-27 09:32:05 UTC


README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Description

The Homeful Contacts Package is a comprehensive solution for managing customer and borrower contact details, including personal information, employment data, addresses, and uploaded documents. It features advanced metadata handling to ensure structured and reliable contact management.

Key Features:

  • Customer & Contact Models: Supports customer and borrower contact details.
  • Contact Metadata: Provides structured metadata for employment, addresses, and uploaded documents.
  • Media Handling: Supports various document types such as IDs, contracts, invoices, and receipts.
  • Integration with Borrower Interface: Ensures seamless connection with the borrowing system.
  • Phone Number Validation: Uses Laravel Phone for formatted phone number management.

Installation

Install via Composer:

composer require jn-devops/contacts

Usage

🔹 Creating a Contact

use Homeful\Contacts\Models\Contact;

$contact = Contact::create([
    'first_name' => 'Juan',
    'last_name' => 'Dela Cruz',
    'email' => 'juan.delacruz@example.com',
    'mobile' => '09171234567',
    'date_of_birth' => '1990-05-15',
]);

🔹 Creating a Customer

use Homeful\Contacts\Models\Customer;

$customer = Customer::create([
    'first_name' => 'Maria',
    'last_name' => 'Santos',
    'email' => 'maria.santos@example.com',
    'mobile' => '09181234567',
]);

🔹 Associating Employment Details

$customer->employment = [
    [
        'type' => 'Primary',
        'monthly_gross_income' => 50000,
        'employment_status' => 'Regular',
        'employer' => [
            "name" => "Tech Solutions Inc.",
            "email" => "hr@techsolutions.com",
            "address" => [
                "type" => "Primary",
                "region" => "NCR",
                "country" => "PH",
                "address1" => "123 Makati Avenue, Makati City",
                "postal_code" => "1200"
            ],
            "industry" => "Technology",
        ]
    ]
];

$customer->save();

🔹 Handling Uploaded Documents

$customer->addMediaFromUrl('https://example.com/uploads/id_image.jpg')->toMediaCollection('id-images');
$customer->addMediaFromUrl('https://example.com/uploads/contract.pdf')->toMediaCollection('contract-documents');

🔹 Retrieving Contact Metadata

use Homeful\Contacts\Classes\ContactMetaData;

$contactMetadata = ContactMetaData::from($customer->toArray());

Testing

Run tests using:

composer test

Author

License

This package is open-source software licensed under the MIT License. See the License File for details.