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

Support Laravel Package

tipoff/support

tipoff/support provides shared Laravel/PHP utilities for Tipoff packages—common helpers, conventions, and support code used across the ecosystem. Intended as an internal foundation dependency to keep other packages consistent and easier to maintain.

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Setup

  1. Installation

    composer require tipoff/support
    

    Add to config/app.php under providers:

    Tipoff\Support\SupportServiceProvider::class,
    
  2. First Use Case: Validation & Form Handling The package provides a Support facade for common ecommerce validation and form logic. Start with:

    use Tipoff\Support\Facades\Support;
    
    // Basic validation example
    $validated = Support::validate(request(), [
        'email' => 'required|email',
        'quantity' => 'integer|min:1'
    ]);
    
  3. Key Entry Points

    • Facade: Support (for core utilities)
    • Traits: HasSupport (for models)
    • Helpers: support() helper function

Implementation Patterns

Core Workflows

1. Model Integration

Extend models with support traits for reusable logic:

use Tipoff\Support\Traits\HasSupport;

class Product extends Model
{
    use HasSupport;

    // Automatically gains support methods
    public function isAvailableForPurchase()
    {
        return $this->isSupportable() && $this->stock > 0;
    }
}

2. Validation & Sanitization

Use the facade for ecommerce-specific validation:

$data = Support::sanitize([
    'price' => '19.99',
    'sku' => 'PROD-123'
], [
    'price' => 'numeric|min:0',
    'sku' => 'string|max:50|alpha_dash'
]);

3. Payment & Order Logic

Leverage built-in payment helpers:

$payment = Support::processPayment($order, [
    'method' => 'stripe',
    'amount' => $order->total,
    'currency' => 'USD'
]);

4. API Response Wrapping

Standardize API responses:

return Support::apiResponse([
    'success' => true,
    'data' => $product
]);

Integration Tips

Laravel Mix/Eloquent

  • Service Container: Bind custom support services:

    $this->app->bind('support.logger', function () {
        return new CustomSupportLogger();
    });
    
  • Observers: Use Support::observe() for model events:

    Support::observe(Order::class, function ($order) {
        // Post-save logic
    });
    

Testing

  • Mock the facade in tests:
    $this->mock(Support::class)->shouldReceive('validate')
        ->once()
        ->andReturn($validatedData);
    

Gotchas and Tips

Pitfalls

  1. Deprecated Methods

    • Support::old() was renamed to Support::flash() in v1.2+. Check changelog for breaking changes.
  2. Overzealous Autoloading

    • The package auto-loads traits on model boot. Disable with:
      class Product extends Model
      {
          protected $disableSupportTraits = true;
      }
      
  3. Payment Gateway Assumptions

    • Default payment methods assume Stripe/PayPal. Override via config:
      'payment' => [
          'default' => 'custom_gateway',
          'gateways' => [
              'custom_gateway' => CustomGateway::class,
          ],
      ],
      

Debugging

  • Enable Verbose Logging

    Support::setLogLevel('debug');
    
  • Check for Silent Failures

    • Wrap facade calls in try-catch:
      try {
          $result = Support::processOrder($order);
      } catch (\Tipoff\Support\Exceptions\SupportException $e) {
          Support::logError($e, ['order_id' => $order->id]);
      }
      

Extension Points

  1. Custom Validators Extend the validator:

    Support::extendValidator('ecommerce', function ($attribute, $value, $parameters) {
        return str_starts_with($value, 'PROD-');
    });
    
  2. Hooks System Register custom hooks:

    Support::hook('order.created', function ($order) {
        // Post-order logic
    });
    
  3. Configuration Overrides Publish config and override defaults:

    php artisan vendor:publish --provider="Tipoff\Support\SupportServiceProvider" --tag="config"
    

Performance Tips

  • Cache Validation Rules

    $rules = Support::cachedRules('product', 3600); // Cache for 1 hour
    
  • Lazy-Load Heavy Dependencies

    Support::lazyLoad('payment_gateway', function () {
        return new HeavyPaymentGateway();
    });
    
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.
sayedenam/sayed-dashboard
milito/query-filter
apiboxsym/user-bundle
apiboxsym/health-check-bundle
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