PHPackages                             jnarvaezp/social-profile - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. jnarvaezp/social-profile

ActiveTastyigniter-extension[Utility &amp; Helpers](/categories/utility)

jnarvaezp/social-profile
========================

Store and manage social media links for customers and staff

01PHP

Since Apr 30Pushed 1mo agoCompare

[ Source](https://github.com/jnarvaezp/plugin-tastyigniter-socialmedia-profile)[ Packagist](https://packagist.org/packages/jnarvaezp/social-profile)[ RSS](/packages/jnarvaezp-social-profile/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Social Profile Extension for TastyIgniter
=========================================

[](#social-profile-extension-for-tastyigniter)

[![TastyIgniter v4](https://camo.githubusercontent.com/732ef1b0bf6d0adc806deee977724ee2abdd4bb6a5b20fcd15dde2df3c81f8f8/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f546173747949676e697465722d76342d6f72616e67652e737667)](https://tastyigniter.com)[![PHP](https://camo.githubusercontent.com/45d36955804bf3f4f17097b05a7f41a28e578dc24e0d3ad0d21ae9d9762f44c6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e312b2d626c75652e737667)](https://php.net)[![License: MIT](https://camo.githubusercontent.com/784362b26e4b3546254f1893e778ba64616e362bd6ac791991d2c9e880a3a64e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e2e737667)](LICENSE)[![GitHub Stars](https://camo.githubusercontent.com/05ea84807577c7f1d36eff95067cc508b3861b57d879732628bf4339ca3233a2/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6a6e61727661657a702f706c7567696e2d746173747969676e697465722d736f6369616c6d656469612d70726f66696c65)](https://github.com/jnarvaezp/plugin-tastyigniter-socialmedia-profile/stargazers)[![GitHub Issues](https://camo.githubusercontent.com/fbf26a42fda26d1ca5604716f32388e23a74b12be6d0d33e3b50a118eb533d63/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f6a6e61727661657a702f706c7567696e2d746173747969676e697465722d736f6369616c6d656469612d70726f66696c65)](https://github.com/jnarvaezp/plugin-tastyigniter-socialmedia-profile/issues)[![GitHub Forks](https://camo.githubusercontent.com/51510a30d00fd26765615d9f7550970bfb96820ea777b7d3ffbbf76cfaf029a4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f6a6e61727661657a702f706c7567696e2d746173747969676e697465722d736f6369616c6d656469612d70726f66696c65)](https://github.com/jnarvaezp/plugin-tastyigniter-socialmedia-profile/network)[![Code Size](https://camo.githubusercontent.com/d38b7f450aa06f5632fc92ef1edd5d45224c946276d454851db1dd26061566ff/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c616e6775616765732f636f64652d73697a652f6a6e61727661657a702f706c7567696e2d746173747969676e697465722d736f6369616c6d656469612d70726f66696c65)](https://github.com/jnarvaezp/plugin-tastyigniter-socialmedia-profile)

A TastyIgniter v4 extension to store and manage social media links (WhatsApp, Telegram, Instagram, Facebook, TikTok) for customers and admin users, with a full REST API and audit logging.

---

Features
--------

[](#features)

- **Custom Admin UI** — Individual labeled text fields for each social platform in Customer and Staff User forms
- **REST API** — `GET` / `PUT` endpoints for reading and updating social links via Sanctum tokens
- **Input Validation** — Only allowed platforms, string values, max 255 chars per link
- **Audit Logging** — Dedicated daily log file with IP, user agent, before/after states
- **Multi-model Support** — Links stored on both `customers` and `admin_users` tables
- **JSON Storage** — Single nullable JSON column per model (no extra tables)

Supported Platforms
-------------------

[](#supported-platforms)

PlatformIconExample ValueWhatsApp`fa-whatsapp``+56912345678`Telegram`fa-telegram``@username`Instagram`fa-instagram``@username`Facebook`fa-facebook``https://facebook.com/username`TikTok`fa-tiktok``@username`---

Requirements
------------

[](#requirements)

- [TastyIgniter v4.0+](https://tastyigniter.com)
- [ti-ext-api](https://tastyigniter.com/docs/extensions/api) extension installed and enabled
- PHP 8.1+
- MySQL 5.7+ or MariaDB 10.3+ (JSON column support)

---

Installation
------------

[](#installation)

### Via Composer (recommended)

[](#via-composer-recommended)

```
cd /path/to/tastyigniter
composer require jnarvaezp/social-profile
php artisan migrate
```

### Manual Installation

[](#manual-installation)

1. Download or clone this repository into your `extensions/` directory:

```
git clone git@github.com:jnarvaezp/plugin-tastyigniter-socialmedia-profile.git extensions/igniter/social-profile
```

2. Run migrations:

```
php artisan migrate
```

3. Enable the extension from **Admin &gt; Manage &gt; Extensions**.
4. Clear cache:

```
php artisan config:clear
php artisan cache:clear
```

---

Database Schema
---------------

[](#database-schema)

This extension adds a single JSON column to two existing tables:

```
-- Customers table
ALTER TABLE customers ADD social_links JSON NULL AFTER last_seen;

-- Admin users table
ALTER TABLE admin_users ADD social_links JSON NULL AFTER last_seen;
```

Example stored value:

```
{
  "whatsapp": "+56987654321",
  "telegram": "@mariagonzalez",
  "instagram": "@mariag",
  "facebook": "https://facebook.com/mariag",
  "tiktok": "@mariag2026"
}
```

---

Admin UI
--------

[](#admin-ui)

After installation, edit any **Customer** or **Staff User** in the Admin panel. A **"Social Links"** tab appears with 5 labeled text fields — one per platform.

The custom `SocialLinksWidget` handles:

- Reading the JSON column and populating each field
- Collecting field values and encoding to JSON on save

---

REST API
--------

[](#rest-api)

The extension registers two API endpoints via TastyIgniter's `ApiManager`.

### Authentication

[](#authentication)

All requests require a **Sanctum Bearer token**. Generate one:

```
php artisan igniter:api-token --name=my_device --email=admin@example.com --admin
```

Or via POST:

```
curl -X POST https://your-site.com/api/token \
  -d "email=admin@example.com&password=your_password&device_name=my_device&is_admin=1"
```

### Endpoints

[](#endpoints)

#### Get Social Links

[](#get-social-links)

```
GET /api/social-links/{customer_id}

```

**Request:**

```
curl -H "Authorization: Bearer YOUR_TOKEN" \
     -H "Accept: application/json" \
     https://your-site.com/api/social-links/1
```

**Response:**

```
{
  "data": {
    "type": "sociallinkscontroller",
    "id": "1",
    "attributes": {
      "customer_id": 1,
      "social_links": {
        "whatsapp": "+56912345678",
        "telegram": "@mariagonzalez"
      }
    }
  }
}
```

#### Update Social Links

[](#update-social-links)

```
PUT /api/social-links/{customer_id}

```

**Request:**

```
curl -X PUT \
     -H "Authorization: Bearer YOUR_TOKEN" \
     -H "Content-Type: application/json" \
     -d '{"social_links":{"whatsapp":"+56999999999","telegram":"@new_username"}}' \
     https://your-site.com/api/social-links/1
```

**Response:**

```
{
  "data": {
    "type": "sociallinkscontroller",
    "id": "1",
    "attributes": {
      "customer_id": 1,
      "social_links": {
        "whatsapp": "+56999999999",
        "telegram": "@new_username"
      }
    }
  }
}
```

### Error Responses

[](#error-responses)

**401 Unauthorized** (no token):

```
{"message": "Unauthenticated."}
```

**422 Validation Error** (invalid platform):

```
{
  "message": "422 Unprocessable Content",
  "errors": {
    "social_links": ["Plataformas no permitidas: linkedin"]
  }
}
```

**422 Validation Error** (non-string value):

```
{
  "message": "422 Unprocessable Content",
  "errors": {
    "social_links": ["El valor de whatsapp debe ser texto."],
    "social_links.whatsapp": ["The social_links.whatsapp must be a string."]
  }
}
```

---

Validation Rules
----------------

[](#validation-rules)

RuleDescriptionAllowed platformsOnly `whatsapp`, `telegram`, `instagram`, `facebook`, `tiktok`Value typeMust be a stringValue lengthMax 255 characters per linkTotal sizeMax 2048 characters (entire JSON)Empty valuesRejected (cannot send empty string)NullAllowed (field is nullable)---

Logging
-------

[](#logging)

The extension creates a dedicated log channel at:

```
storage/logs/social-profile-YYYY-MM-DD.log

```

- **Daily rotation** with 30-day retention
- **Show events**: logs customer\_id, IP, user agent
- **Update events**: logs customer\_id, IP, before state, input, after state

Example log entry:

```
[2026-04-25 18:00:02] local.INFO: social_links.update.request
{"customer_id":9,"ip":"127.0.0.1",
 "before":{"telegram":"@old","whatsapp":"+56912345678"},
 "input":{"whatsapp":"+56999999999","telegram":"@new"}}

```

---

Architecture
------------

[](#architecture)

```
extensions/igniter/social-profile/
├── config/
│   └── social_profile.php              # Platform definitions
├── database/migrations/
│   ├── ..._add_social_links_to_customers.php
│   └── ..._add_social_links_to_admin_users.php
├── resources/views/_partials/formwidgets/sociallinks/
│   └── sociallinks.blade.php           # Widget template (5 inputs)
└── src/
    ├── Extension.php                   # Boot: form fields, validation, API, logging
    ├── FormWidgets/
    │   └── SocialLinksWidget.php       # Custom admin form widget
    ├── ApiResources/
    │   ├── Repositories/
    │   │   └── SocialLinksRepository.php   # Data layer (array to JSON encode)
    │   ├── Requests/
    │   │   └── SocialLinksRequest.php      # API validation
    │   └── Transformers/
    │       └── SocialLinksTransformer.php  # Fractal response transformer
    └── Http/Controllers/
        └── SocialLinksController.php       # REST controller + audit logging

```

---

Security
--------

[](#security)

AspectStatusSanctum token authRequired on all API endpointsToken abilities`social-links:*` requiredPlatform whitelistOnly 5 allowed platformsInput validationString type, max 255 per value, max 2048 totalSQL injectionProtected by Eloquent ORMXSS (Admin UI)Blade `{{ }}` auto-escapesCSRF (Admin UI)Standard Laravel CSRF middlewareRate limitingLaravel `ThrottleRequests` (60 req/min)Audit loggingAll reads and writes logged with IP---

Permissions
-----------

[](#permissions)

The extension registers the `Admin.SocialProfile` permission. Assign it to admin roles that should manage social links.

---

Contributing
------------

[](#contributing)

1. Fork the repository
2. Create your feature branch: `git checkout -b feature/my-feature`
3. Commit your changes: `git commit -am 'Add my feature'`
4. Push to the branch: `git push origin feature/my-feature`
5. Open a Pull Request

---

License
-------

[](#license)

This project is licensed under the MIT License — see the [LICENSE](LICENSE) file for details.

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance61

Regular maintenance activity

Popularity1

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/aae91f73f3f4a50e7ee638097a15ec8cefc81bf8043b3e24ffe1ed29166e200f?d=identicon)[jnarvaezp](/maintainers/jnarvaezp)

---

Top Contributors

[![jnarvaezp](https://avatars.githubusercontent.com/u/788597?v=4)](https://github.com/jnarvaezp "jnarvaezp (3 commits)")

### Embed Badge

![Health badge](/badges/jnarvaezp-social-profile/health.svg)

```
[![Health](https://phpackages.com/badges/jnarvaezp-social-profile/health.svg)](https://phpackages.com/packages/jnarvaezp-social-profile)
```

###  Alternatives

[timacdonald/has-parameters

A trait that allows you to pass arguments to Laravel middleware in a more PHP'ish way.

228288.1k4](/packages/timacdonald-has-parameters)[duncan3dc/sessions

A non-blocking session manager

28242.6k8](/packages/duncan3dc-sessions)[ju1ius/webpack-assets-bundle

Integrates Webpack into Symfony2

1461.8k](/packages/ju1ius-webpack-assets-bundle)

PHPackages © 2026

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