Download the PHP package palpalani/baylinks-laravel without Composer
On this page you can find all versions of the php package palpalani/baylinks-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download palpalani/baylinks-laravel
More information about palpalani/baylinks-laravel
Files in palpalani/baylinks-laravel
Package baylinks-laravel
Short Description PHP/Laravel framework SDK for BayLinks.
License MIT
Homepage https://github.com/palpalani/baylinks-laravel
Informations about the package baylinks-laravel
About
This Laravel package provides an elegant, fluent interface to the BayLinks API - a powerful URL shortening and management platform for modern businesses. Built on top of Saloon PHP, this SDK offers type-safe request/response handling, robust error management, and seamless Laravel integration.
Features
- 🎯 Type-Safe: Full PHP 8.3+ type safety with PHPStan level 4 analysis
- 🚀 Modern Architecture: Built on Saloon PHP for elegant HTTP client abstraction
- 🔒 Secure: Per-request API key authentication with built-in error handling
- 🧪 Well-Tested: Comprehensive test suite with Pest PHP
- 📦 Laravel Native: First-class Laravel integration with service provider and facade
- 🔄 Bulk Operations: Support for bulk URL creation and management
- 📊 Analytics: Track URL visit records and performance metrics
- 🎨 PSR Compliant: Follows PSR-1, PSR-2, and PSR-12 coding standards
Requirements
- PHP 8.3 or higher
- Laravel 10.x, 11.x, or 12.x
- Composer 2.x
Installation
Install the package via Composer:
Configuration
Publish the configuration file:
This creates config/baylinks-laravel.php with the following structure:
Update your .env file:
Usage
Basic Examples
Retrieve Account Information
Create a Single Short URL
Create Multiple Short URLs (Bulk)
Advanced Usage
Update Short URL Status
Retrieve Visit Records
Using Dependency Injection
Error Handling
API Reference
Client Initialization
Available Methods
Account Operations
| Method | Description | Parameters |
|---|---|---|
accountDetails()->get($apiKey) |
Retrieve account information | string $apiKey |
URL Operations
| Method | Description | Parameters |
|---|---|---|
createShortURL()->post($apiKey, $data) |
Create a single short URL | string $apiKey, array $data |
createBulkURL()->post($apiKey, $data) |
Create multiple short URLs | string $apiKey, array $data |
updateShortURLStatus()->post($apiKey, $data) |
Update URL status | string $apiKey, array $data |
ShortUrlVisitRecord()->post($apiKey, $data) |
Get visit analytics | string $apiKey, array $data |
Request Payload Schemas
Create Short URL
Create Bulk URLs
Testing
Run the full test suite with Pest:
Run tests with coverage:
Run specific test file:
Run tests with filtering:
Code Quality
Run PHPStan static analysis:
Format code with Laravel Pint:
Development
Architecture
This package uses Saloon PHP for HTTP client abstraction:
- Factory: Main connector extending
Saloon\Http\Connector - Resources: Group related API endpoints (
AccountResource,CreateShortURLResource) - Requests: Individual API requests extending
Saloon\Http\Request - Responses: Transform API responses to DTOs
- Objects: Immutable data transfer objects
Adding New Endpoints
- Create a new Request class in
src/Requests/{Category}/ - Create a corresponding Response class in
src/Responses/{Category}/ - Add a Resource method or create new Resource in
src/Resources/ - Update the Factory with a new resource method if needed
- Write tests in
tests/
See CLAUDE.md for detailed development guidelines.
Continuous Integration
This package uses GitHub Actions for automated testing and quality checks:
| Workflow | Purpose | Trigger |
|---|---|---|
| Tests | Run Pest tests across PHP 8.3-8.4, Laravel 11-12, Ubuntu/Windows | Push, PR |
| PHPStan | Static analysis at level 4 | Push, PR |
| Code Coverage | Track test coverage with Codecov | Push, PR |
| Security Scan | Composer audit, dependency review, SBOM generation | Push, PR, Weekly |
| Code Style | Auto-fix with Laravel Pint | Push (branches only) |
| PR Quality | Validate composer.json, check for debug statements | PR only |
All workflows use Composer caching for faster builds and concurrency controls to prevent redundant runs.
Troubleshooting
Common Issues
"Class 'BayLinks' not found"
Make sure you've published the service provider:
Authentication Errors
Verify your API key is correct and active:
SSL Certificate Issues
If you encounter SSL errors in development:
Changelog
Please see CHANGELOG for recent changes and version history.
Contributing
We welcome contributions! Here's how you can help:
Getting Started
- Fork the repository
- Create a feature branch:
git checkout -b feature/my-new-feature - Make your changes and commit:
git commit -am 'Add new feature' - Push to the branch:
git push origin feature/my-new-feature - Submit a pull request
Development Guidelines
- Follow PSR-1, PSR-2, and PSR-12 coding standards
- Write tests for new features (we use Pest)
- Ensure PHPStan passes at level 4:
composer analyse - Format code with Pint:
composer format - Update documentation for API changes
- Add entries to CHANGELOG.md
Running Tests
Pull Request Checklist
- [ ] Tests pass (
composer test) - [ ] Static analysis passes (
composer analyse) - [ ] Code is formatted (
composer format) - [ ] Documentation is updated
- [ ] CHANGELOG.md is updated
Security
If you discover any security-related issues, please email [email protected] instead of using the issue tracker. All security vulnerabilities will be promptly addressed.
Credits
- palPalani - Creator & Maintainer
- Prasanth - Core Developer
- All Contributors - Community Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of baylinks-laravel with dependencies
illuminate/contracts Version ^10.0 || ^11.0 || ^12.0
saloonphp/saloon Version ^3.14
spatie/laravel-package-tools Version ^1.92.7