convertain/laravel-babylovegrowth

Laravel package for integrating with BabyLoveGrowth.ai API to fetch and store AI-curated parenting articles and baby development content

v1.0.0 2025-08-05 17:54 UTC

This package is auto-updated.

Last update: 2025-08-05 17:59:47 UTC


README

Latest Version on Packagist Total Downloads CI PHPStan Level 10 PHP 8.3+ Laravel 12

A Laravel package for integrating with the BabyLoveGrowth.ai* API to fetch and manage SEO-optimized articles for organic traffic growth in your Laravel application.

Affiliate Disclosure: This package integrates with BabyLoveGrowth.ai*, and we may receive compensation if you sign up for their services through our affiliate links (marked with *). This does not affect the functionality of the package or increase your costs. We only recommend services we believe provide value to developers and businesses.

Features

  • 🚀 Simple API Integration - Fetch SEO-optimized articles from BabyLoveGrowth.ai* with a single command
  • 🔍 Domain Filtering - Optional filtering by specific domains/websites
  • 🌍 Language Support - Filter and categorize articles by language (20+ languages supported)
  • 📦 Local Storage - Store articles in your database for offline access and fast queries
  • Automatic Sync - Background sync capabilities with configurable intervals
  • 🛡️ Type Safe - Full PHPStan level 10 compliance for robust code
  • 🎯 Laravel Native - Built with Laravel best practices and conventions

Installation

Install the package via Composer:

composer require convertain/laravel-babylovegrowth

The package will automatically register its service provider and make the configuration and migrations available.

Run Migrations

Run the database migrations:

php artisan migrate

Optional: Publish Configuration

If you need to customize the configuration, you can optionally publish the config file:

php artisan vendor:publish --tag=babylovegrowth-config

Optional: Publish Migrations

If you need to customize the database schema, you can optionally publish the migrations:

php artisan vendor:publish --tag=babylovegrowth-migrations
php artisan migrate

Configuration

Add your BabyLoveGrowth.ai* API credentials to your .env file:

BABYLOVEGROWTH_ENABLED=true
BABYLOVEGROWTH_API_KEY=your-api-key-here
BABYLOVEGROWTH_DOMAIN_FILTER=example.com  # Optional: filter by specific domain

💡 Need an API key? If you find this package useful and don't have a BabyLoveGrowth.ai* account yet, please consider signing up through our affiliate link* to support the development of this package.

That's it! The package works immediately with just the environment variables. No need to publish configuration files unless you want to customize the defaults.

Advanced Configuration

If you published the configuration file (config/babylovegrowth.php), you can customize:

  • enabled - Enable/disable the integration
  • api_key - Your BabyLoveGrowth.ai* API key
  • domain_filter - Optional domain filter for articles
  • cache_ttl - Cache time-to-live for API responses (in seconds)

Usage

Database Setup

Run the migrations to create the required database tables:

php artisan migrate

Seeders

The package includes a factory-based seeder that uses FakerPHP to generate realistic, randomly-varied BabyLoveGrowth SEO articles:

php artisan db:seed --class="Database\Seeders\BabyLoveGrowthArticleSeeder"

This will create 15 unique articles with dynamically generated content featuring:

  • Smart Title Generation: Pattern-based templates with contextual variables
  • Dynamic Content: Realistic paragraphs using Faker's text generation
  • Varied Sections: 3-6 sections per article with contextual topics
  • Natural Language: Template-based sentences with SEO/content marketing focus
  • Realistic Metadata: Proper meta descriptions, image URLs, and timestamps
  • Multi-language Support: Articles in English, Spanish, French, German, Italian, and Portuguese

Each article follows the exact BabyLoveGrowth.ai* API structure while providing completely unique, realistic content every time the seeder runs.

Fetching Articles

Use the Artisan command to fetch articles from the BabyLoveGrowth.ai* API:

# Fetch all articles
php artisan babylovegrowth:fetch

# Fetch articles with filters
php artisan babylovegrowth:fetch --language=en
php artisan babylovegrowth:fetch --domain=example.com
php artisan babylovegrowth:fetch --force  # Force update existing articles

Using the Model

Query articles using the Eloquent model:

use Convertain\BabyLoveGrowth\Models\BabyLoveGrowthArticle;

// Get all articles
$articles = BabyLoveGrowthArticle::all();

// Get articles by language
$englishArticles = BabyLoveGrowthArticle::byLanguage('en')->get();

// Get published articles (ordered by date)
$recentArticles = BabyLoveGrowthArticle::published()->take(10)->get();

// Get articles with content
$articlesWithContent = BabyLoveGrowthArticle::withContent()->get();

// Find by external ID
$article = BabyLoveGrowthArticle::findByExternalId(123);

// Find by slug
$article = BabyLoveGrowthArticle::findBySlug('parenting-tips');

Article Properties

Each BabyLoveGrowthArticle model includes:

$article->id;                    // Local database ID
$article->external_id;           // [BabyLoveGrowth.ai](https://af.boaa.it/babylovegrowth)* article ID
$article->title;                 // Article title
$article->slug;                  // URL-friendly slug
$article->language_code;         // Language code (e.g., 'en', 'es')
$article->org_website;           // Organization website
$article->content_markdown;      // Markdown content
$article->content_html;          // HTML content
$article->meta_description;      // SEO meta description
$article->hero_image_url;        // Featured image URL
$article->external_created_at;   // Original creation date
$article->created_at;            // Local creation date
$article->updated_at;            // Local update date

Helper Methods

The model includes several helpful methods:

// Check if article has content
if ($article->hasContent()) {
    // Article has either markdown or HTML content
}

// Get excerpt (auto-generated from meta description or content)
$excerpt = $article->getExcerpt(200); // Limit to 200 characters

// Get estimated reading time
$readingTime = $article->reading_time; // Returns minutes

Programmatic API Usage

Use the API service directly in your code:

use Convertain\BabyLoveGrowth\Services\BabyLoveGrowthApiService;
use Convertain\BabyLoveGrowth\Services\DomainFilterService;

// Fetch articles from API
$apiService = app(BabyLoveGrowthApiService::class);
$articles = $apiService->getAllArticles();

// Apply domain filtering
$domainFilter = app(DomainFilterService::class);
$shouldInclude = $domainFilter->shouldSyncArticle('https://example.com/article');

Background Sync

Use the sync service for automated synchronization:

use Convertain\BabyLoveGrowth\Services\BabyLoveGrowthSyncService;

$syncService = app(BabyLoveGrowthSyncService::class);

// Check if sync should run
if ($syncService->shouldSync()) {
    $result = $syncService->sync();
}

// Get sync statistics
$stats = $syncService->getSyncStats();

Database Schema

The package creates a blog_babylovegrowth_articles table with the following structure:

Column Type Description
id bigint Primary key
external_id integer BabyLoveGrowth.ai* article ID
title string Article title
slug string URL slug
language_code string Language code
org_website string Organization website
content_markdown text Markdown content
content_html text HTML content
meta_description text SEO description
hero_image_url string Featured image URL
external_created_at timestamp Original creation date
created_at timestamp Local creation date
updated_at timestamp Local update date

Error Handling

The package includes comprehensive error handling:

use Convertain\BabyLoveGrowth\Exceptions\BabyLoveGrowthApiException;

try {
    $articles = $apiService->getAllArticles();
} catch (BabyLoveGrowthApiException $e) {
    // Handle API errors
    logger()->error('BabyLoveGrowth API Error: ' . $e->getMessage());
}

Testing

Run the package tests:

composer test

Run tests with coverage:

composer test-coverage

Run static analysis:

composer analyse

Run code style checks:

composer pint -- --test

Fix code style issues:

composer pint

Continuous Integration

This package includes comprehensive GitHub Actions workflows:

  • Tests: Runs PHPUnit tests across PHP 8.3 and 8.4 with Laravel 12.x
  • Static Analysis: PHPStan Level 10 analysis for type safety
  • Code Style: Laravel Pint PSR-12 compliance checking
  • Security: Automated vulnerability scanning with composer audit

All workflows run on push/pull requests to ensure code quality.

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email security@convertain.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

About BabyLoveGrowth.ai

BabyLoveGrowth.ai* is an AI-powered SEO and content marketing automation platform that helps businesses grow organic traffic through automated content generation and backlink building. The platform provides:

  • Daily SEO/LLM-optimized articles with real-time research and expert citations
  • Automated backlink exchange network to boost domain authority
  • Multi-language content generation (20+ languages supported)
  • Direct publishing integration with WordPress, Webflow, Shopify, and other platforms
  • JSON-LD schema markup for enhanced search visibility
  • ChatGPT and Google optimization for maximum organic reach

This package enables Laravel applications to integrate with their content API for seamless access to high-quality SEO-optimized articles.

For more information about BabyLoveGrowth.ai, visit their website.

*Affiliate links - we may receive compensation if you sign up through these links.