Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Openinviter Bundle Laravel Package

artseld/openinviter-bundle

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Steps to First Invitation Flow

  1. Install the Bundle

    composer require artseld/openinviter-bundle
    

    (Note: The original README uses a legacy Git-based install; Composer is preferred for modern Laravel/Symfony integration.)

  2. Configure Credentials Add your OpenInviter credentials to config/services.php (Laravel) or config/packages/artseld_openinviter.yaml (Symfony):

    artseld_openinviter:
        username: "YOUR_OPENINVITER_USERNAME"
        private_key: "YOUR_API_KEY"
        plugins_cache_time: 1800  # Cache plugins for 30 minutes
    
  3. Set Up Routes Add the bundle’s routes to routes/web.php (Laravel) or config/routes.yaml (Symfony):

    // Laravel (routes/web.php)
    Route::prefix('open-inviter')->group(function () {
        require __DIR__.'/../vendor/artseld/openinviter-bundle/src/Resources/config/routing.php';
    });
    
  4. First Use Case: Display Available Providers Create a controller to fetch and render available invitation providers:

    use Artseld\OpeninviterBundle\Service\OpenInviterService;
    
    class InviteController extends Controller {
        public function index(OpenInviterService $openInviter) {
            $providers = $openInviter->getProviders();
            return view('invite.providers', compact('providers'));
        }
    }
    

Implementation Patterns

Workflow: Invitation Flow

  1. Fetch Providers Use the service to list supported providers (e.g., Gmail, LinkedIn, Facebook):

    $providers = $openInviter->getProviders();
    
  2. Authenticate User Redirect users to OpenInviter’s OAuth flow:

    $authUrl = $openInviter->getAuthUrl('gmail', ['redirect_uri' => route('invite.callback')]);
    return redirect($authUrl);
    
  3. Handle Callback Process the OAuth callback to fetch contacts:

    public function callback(OpenInviterService $openInviter) {
        $contacts = $openInviter->getContacts('gmail', $this->request->query->all());
        // Store contacts in DB or process further
    }
    
  4. Send Invitations Use the service to send bulk invites:

    $results = $openInviter->sendInvites([
        'to' => ['email1@example.com', 'email2@example.com'],
        'message' => 'Join our platform!'
    ]);
    

Integration Tips

  • Laravel-Specific: Use Laravel’s service container to bind the bundle’s service:
    $this->app->bind('artseld.openinviter', function ($app) {
        return new \Artseld\OpeninviterBundle\Service\OpenInviterService(
            $app['config']['artseld_openinviter']
        );
    });
    
  • Caching: Leverage Laravel’s cache (e.g., Redis) for plugins_cache_file to avoid file-system dependencies:
    artseld_openinviter:
        plugins_cache_file: "cache:oi_plugins"  # Use Laravel's cache driver
    
  • Queue Jobs: Offload heavy operations (e.g., contact sync) to Laravel queues:
    dispatch(new SyncContactsJob($provider, $credentials));
    

Gotchas and Tips

Pitfalls

  1. Deprecated Symfony Version The bundle targets Symfony 2.1–2.3. For Laravel, use a wrapper or fork (e.g., laravel-openinviter). Workaround: Manually adapt the service class to Laravel’s DI container.

  2. Missing Laravel Configuration The bundle expects Symfony’s config.yml. For Laravel, map YAML config to config/services.php:

    'openinviter' => [
        'username' => env('OPENINVITER_USERNAME'),
        'private_key' => env('OPENINVITER_API_KEY'),
        'plugins_cache_time' => 1800,
    ],
    
  3. Plugin Cache Issues The default plugins_cache_file uses filesystem paths. For Laravel, override the cache handler:

    $openInviter->setCacheHandler(new LaravelCacheHandler(storage_path('framework/cache')));
    
  4. Transport Layer The bundle defaults to wget. For Laravel, set transport: "curl" in config to avoid dependency conflicts.

Debugging

  • Enable Debugging Set local_debug: "on_error" in config to log errors to storage/logs/laravel.log.
  • OAuth Debugging Use OpenInviter’s debug mode and check Laravel’s storage/logs/ for OAuth callback errors.

Extension Points

  1. Custom Providers Extend the service to support non-OpenInviter providers:

    class CustomProvider extends \OpenInviter\Provider {
        public function getContacts() { /* ... */ }
    }
    

    Register it via:

    $openInviter->addProvider('custom', new CustomProvider());
    
  2. Webhook Handling For real-time contact updates, implement a Laravel route to handle OpenInviter webhooks:

    Route::post('openinviter/webhook', [InviteController::class, 'handleWebhook']);
    
  3. Rate Limiting Add Laravel’s throttle middleware to API routes to comply with OpenInviter’s rate limits:

    Route::middleware(['throttle:60,1'])->group(function () {
        // OpenInviter API routes
    });
    
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle