minulhasanrokan / customer-social-finder
Find customer social profiles by name, profession, company, and location using Google Custom Search.
Requires
- php: ^8.0
- illuminate/support: ^10.0 || ^11.0 || ^12.0
README
A Laravel package to help find social media profiles (LinkedIn, Facebook, Twitter) of a person based on their name, profession, company, and location β using the Google Custom Search API.
π Features
- π§ Accepts name, profession, company, and location as input
- π Searches LinkedIn, Facebook, and Twitter using Google Custom Search
- π· Displays title, link, snippet, and thumbnail (if available)
- π¨ Includes a ready-to-use Blade view
π₯ Installation
Step 1: Require via Composer
composer require minulhasanrokan/customer-social-finder
π Publish Views (Optional)
To publish the default Blade view:
php artisan vendor:publish --tag=views
βοΈ Configuration
Step 1: Add Google API credentials to .env
GOOGLE_API_KEY=your_google_api_key GOOGLE_CX_ID=your_custom_search_engine_id
Step 2: Update config/services.php
'google' => [ 'key' => env('GOOGLE_API_KEY'), 'cx' => env('GOOGLE_CX_ID'), ],
π Route Setup
You can add a route in your web.php
to use the form:
use Minulhasanrokan\CustomerSocialFinder\Http\Controllers\SocialProfileController; Route::match(['get', 'post'], '/social-finder', [SocialProfileController::class, 'index']);
πΌοΈ Blade View Example
Hereβs how the output is structured:
@foreach ($results as $result) <div class="profile-card"> <h3>{{ $result['title'] }}</h3> <a href="{{ $result['link'] }}" target="_blank">{{ $result['link'] }}</a> <p>{{ $result['snippet'] }}</p> @if($result['image']) <img src="{{ $result['image'] }}" alt="Thumbnail"> @endif </div> @endforeach
π How to Get Google API Credentials
- Visit Google Cloud Console
- Create a new project
- Enable Custom Search JSON API
- Go to Programmable Search Engine
- Create a new search engine with sites like:
*.linkedin.com, *.facebook.com, *.twitter.com
- Get your Search Engine ID (cx) and API key
π§Ύ Example Search Query
The search will build something like:
John Doe Software Engineer Acme Inc New York site:linkedin.com OR site:facebook.com OR site:twitter.com
This query is passed to Googleβs Custom Search API.
π Requirements
- PHP ^8.0
- Laravel ^10.0 || ^11.0 || ^12.0
- Google Custom Search API credentials
π Project Structure
src/ βββ Http/ β βββ Controllers/ β βββ SocialProfileController.php βββ resources/ β βββ views/ β βββ form.blade.php βββ routes/ β βββ web.php βββ CustomerSocialFinderServiceProvider.php
π License
MIT License Β© Md. Minul Hasan