PHPackages                             developerabod/laravel-contact-exporter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. developerabod/laravel-contact-exporter

ActiveLibrary[File &amp; Storage](/categories/file-storage)

developerabod/laravel-contact-exporter
======================================

A Laravel package to efficiently manage and export contacts as vCard (.vcf) files.

1.0.0(4mo ago)361MITPHPPHP ^8.3

Since Feb 22Pushed 4mo agoCompare

[ Source](https://github.com/DeveloperAbod/laravel-contact-exporter)[ Packagist](https://packagist.org/packages/developerabod/laravel-contact-exporter)[ RSS](/packages/developerabod-laravel-contact-exporter/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (5)Versions (2)Used By (0)

📇 Laravel Contact Exporter
==========================

[](#-laravel-contact-exporter)

[![Laravel Contact Exporter](https://raw.githubusercontent.com/DeveloperAbod/laravel-contact-exporter/master/laravel-contact-exporter-profile.png)](https://raw.githubusercontent.com/DeveloperAbod/laravel-contact-exporter/master/laravel-contact-exporter-profile.png)

**A Laravel package to export database contacts as vCard (`.vcf`) files — clean, professional, and effortless.** [![PHP](https://camo.githubusercontent.com/a81afe789314fa31a8a0f7b0fd5c5b21b5dc580b6ee85bb108c48eac67e7d9f3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253545382e332d626c75653f7374796c653d666c61742d737175617265266c6f676f3d706870)](https://php.net)[![Laravel](https://camo.githubusercontent.com/56fef1efbd604711ca6bcaf7a2217af6e022b5a336e6ab3c1837b6f76484d2b6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d3130253230253743253230313125323025374325323031322d7265643f7374796c653d666c61742d737175617265266c6f676f3d6c61726176656c)](https://laravel.com)[![License: MIT](https://camo.githubusercontent.com/152aa2a37725b9fd554b28ff24d270f6071c67927a63e6d635a55c8e188e20c7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e3f7374796c653d666c61742d737175617265)](LICENSE)

```
composer require developerabod/laravel-contact-exporter
```

---

✨ Features
----------

[](#-features)

- 📱 Export contacts as a `.vcf` file ready to import on any smartphone
- 🌍 Full Arabic name support with UTF-8 charset
- 🚀 Chunked database reading — memory-safe with millions of records
- 🔌 Works with both **Eloquent Models** and **`DB::table`** queries
- 🧩 Clean **Fluent API** — intuitive and expressive
- ⚙️ Fully configurable without touching the package source code

---

📦 Installation
--------------

[](#-installation)

### Step 1 — Install via Composer

[](#step-1--install-via-composer)

```
composer require developerabod/laravel-contact-exporter
```

### Step 2 — Publish the Config File

[](#step-2--publish-the-config-file)

```
php artisan vendor:publish --tag=vcard-exporter-config
```

This creates the file: `config/vcard-exporter.php`

---

⚙️ Configuration
----------------

[](#️-configuration)

Open `config/vcard-exporter.php` and map each config key to the actual column name in your database table:

```
return [

    'table' => 'users', // Your database table name

    'columns' => [
        'first_name'   => 'first_name',  // The column name in your table
        'last_name'    => null,           // null = disabled by default
        'middle_name'  => null,

        'phone_mobile' => 'phone',        // Primary mobile number — required
        'phone_work'   => null,         // Optional work phone number (disabled by default)
        'phone_home'   => null,        // Optional home phone number (disabled by default)

        'email'        => null,           // null = disabled by default
    ],

    'filename'         => 'contacts',     // Base name of the exported file (e.g. contacts.csv)
    'append_count'     => true, // If true: appends total contact count to filename, Example:contacts_250.vcf
    'append_date'      => false, // If true: appends export date to filename Example: contacts_2026-02-22.vcf
    'skip_empty_phone' => true,
    'normalize_phone'  => true,
    'charset_utf8'     => true, // Enables UTF-8 encoding to support arabic
    'chunk_size'       => 500,  // Chunk size for optimized processing

];
```

> **Note:** `last_name` and `email` are disabled by default. Enable them at runtime using `withLastName()` and `withEmail()` on the `VCard` facade — no config changes needed.

---

🚀 Usage
-------

[](#-usage)

### Simplest Case — Relies entirely on config

[](#simplest-case--relies-entirely-on-config)

```
use VCard;

public function export()
{
    return VCard::download();
    // Output: contacts_250.vcf
}
```

---

### With Last Name

[](#with-last-name)

```
return VCard::withLastName()->download();
```

---

### With Email

[](#with-email)

```
return VCard::withEmail()->download();
```

---

### With Both Last Name and Email

[](#with-both-last-name-and-email)

```
return VCard::withLastName()->withEmail()->download();
```

---

### Different Table (overrides config)

[](#different-table-overrides-config)

```
return VCard::from('users')->download();
```

---

### Override Column Mapping (without changing config)

[](#override-column-mapping-without-changing-config)

```
return VCard::map([
    'first_name'   => 'name',
    'phone_mobile' => 'mobile_number',
])->download();
```

---

### With WHERE Conditions

[](#with-where-conditions)

```
return VCard::where(['active' => 1])->download();

// Multiple conditions
return VCard::where(['active' => 1, 'country' => 'SA'])->download();
```

> **Note:** `where()` only works when using `from()`. Do **not** combine it with `fromQuery()`.

---

### From an Eloquent Model

[](#from-an-eloquent-model)

```
// All records
return VCard::fromQuery(Contact::query())->download();

// Using an existing scope on the model
return VCard::fromQuery(Contact::active())->download();

// With custom constraints
return VCard::fromQuery(
    Contact::where('country', 'SA')->orderBy('first_name')
)->download();
```

> **Important:** When using `fromQuery()`, apply all conditions directly to the query **before** passing it in. Do not chain `where()` on the VCard facade alongside `fromQuery()`.

---

### From a `DB::table` Query

[](#from-a-dbtable-query)

```
return VCard::fromQuery(
    DB::table('contacts')->where('active', 1)
)->download();
```

---

### Custom Filename

[](#custom-filename)

```
return VCard::download('company_employees');
// Output: company_employees_150.vcf
```

---

### Full Control — All Options Combined

[](#full-control--all-options-combined)

```
return VCard::fromQuery(Contact::active())
    ->map([
        'first_name'   => 'fname',
        'last_name'    => 'lname',
        'phone_mobile' => 'mobile',
        'phone_work'   => 'work_phone',
        'email'        => 'email',
    ])
    ->withLastName()
    ->withEmail()
    ->filename('contacts_export')
    ->chunkSize(1000)
    ->download();
```

---

📋 Configuration Reference
-------------------------

[](#-configuration-reference)

OptionDescriptionDefault`table`Database table name`contacts``filename`Output filename without `.vcf` extension`contacts``append_count`Append the total record count to the filename`true``append_date`Append today's date to the filename`false``skip_empty_phone`Skip records that have no phone number`true``normalize_phone`Strip symbols and formatting from phone numbers`true``charset_utf8`Enable UTF-8 charset for Arabic name support`true``chunk_size`Number of records to process per chunk`500`---

📖 API Reference
---------------

[](#-api-reference)

MethodDescription`from(string $table)`Set the database table to query`fromQuery($query)`Pass in a ready-made Eloquent or `DB::table` query builder`map(array $columns)`Override the column mapping at runtime`where(array $conditions)`Add WHERE conditions (only works with `from()`)`withLastName()`Enable the last name field`withEmail()`Enable the email field`filename(string $name)`Set a custom output filename`chunkSize(int $size)`Override the chunk size for this export`download(?string $filename)`Execute the export and stream the `.vcf` file---

🏗️ Package Structure
--------------------

[](#️-package-structure)

```
src/
├── Support/
│   ├── ExportConfig.php       ← Data object holding all resolved settings
│   └── ColumnMap.php          ← Column mapping between config keys and DB columns
├── VCardBuilder.php           ← Builds vCard 3.0 formatted strings
├── VCardDownloader.php        ← Reads from DB in chunks and streams the file
├── VCardExporter.php          ← The fluent API builder
├── Facades/
│   └── VCard.php              ← Laravel Facade
└── Providers/
    └── VCardServiceProvider.php

config/
└── vcard-exporter.php

```

---

📋 Requirements
--------------

[](#-requirements)

RequirementVersionPHP`^8.3`Laravel`^10 | ^11 | ^12`---

📄 License
---------

[](#-license)

Open source, released under the [MIT License](LICENSE).

---

Made with ❤️ by [Developer Abod](https://github.com/developerabod)

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance76

Regular maintenance activity

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

132d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/52f99107b0e19ef61b800664aca36879fa30db297801ea97d913ccd74884b5a6?d=identicon)[DeveloperAbod](/maintainers/DeveloperAbod)

---

Top Contributors

[![DeveloperAbod](https://avatars.githubusercontent.com/u/98879580?v=4)](https://github.com/DeveloperAbod "DeveloperAbod (8 commits)")

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/developerabod-laravel-contact-exporter/health.svg)

```
[![Health](https://phpackages.com/badges/developerabod-laravel-contact-exporter/health.svg)](https://phpackages.com/packages/developerabod-laravel-contact-exporter)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[laravel/ai

The official AI SDK for Laravel.

1.0k3.2M199](/packages/laravel-ai)[yajra/laravel-oci8

Oracle DB driver for Laravel via OCI8

8793.2M25](/packages/yajra-laravel-oci8)[mike-bronner/laravel-model-caching

Automatic caching for Eloquent models.

2.4k91.9k1](/packages/mike-bronner-laravel-model-caching)[glushkovds/phpclickhouse-laravel

Adapter of the most popular library https://github.com/smi2/phpClickHouse to Laravel

2051.5M2](/packages/glushkovds-phpclickhouse-laravel)[api-platform/laravel

API Platform support for Laravel

58171.6k14](/packages/api-platform-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
