Download the PHP package toolkito/larasap without Composer
On this page you can find all versions of the php package toolkito/larasap. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package larasap
๐ Introduction Laravel Social Auto Posting (Larasap)
Important Notice: This package has been moved from
toolkito/larasap
toalihesari/larasap
. The old package is no longer maintained. Please use the new namespace for all future installations.
A powerful Laravel package that enables automated posting to multiple social media platforms including Telegram, X (Twitter), and Facebook. This package provides a simple and elegant way to manage your social media presence.
๐ Authentication Methods
X (Twitter) API Authentication
This package uses OAuth 1.0a for X API authentication because:
- It's better suited for server-side automated posting
- Provides simpler implementation for Laravel applications
- No need to handle token refresh flows
- Works well with Laravel's configuration system
While X also supports OAuth 2.0, OAuth 1.0a is the recommended choice for this package's use case of automated server-side posting.
Facebook API Authentication
The package uses Facebook Graph API with Page Access Token for authentication. This provides:
- Secure access to Facebook Pages
- Long-lived tokens
- Granular permissions control
- Easy integration with Laravel's configuration system
Telegram Bot API Authentication
Uses Telegram Bot API token for authentication, providing:
- Simple token-based authentication
- Secure communication
- Easy setup process
๐ Features
Telegram Features
- ๐ Send text messages
- ๐ท Send photos with captions
- ๐ต Send audio files with metadata
- ๐ Send documents
- ๐บ Send videos with metadata
- ๐ Send voice messages
- ๐ด Send media groups (2-10 items)
- ๐ Send locations
- ๐ Send venues
- ๐ Send contacts
- ๐ Send messages with inline keyboards
- โ๏ธ Edit messages and captions
- ๐ Pin/unpin messages
- ๐ Message retry with backoff
X (Twitter) Features
- โจ Send text tweets
- ๐ผ๏ธ Send tweets with media (up to 4 items)
- ๐ฃ๏ธ Reply to tweets
- ๐ฌ Quote tweets
- ๐ Create polls
- ๐ Add location to tweets
- โฐ Schedule tweets
- ๐ Rate limit handling
- ๐ Automatic retry with backoff
Facebook Features
- ๐ Share links with descriptions
- ๐ธ Post photos with captions
- ๐ฅ Share videos with titles and descriptions
- โฐ Schedule posts
- ๐ Privacy controls
- ๐ฏ Post targeting
- ๐ Debug mode
- ๐ Error handling and logging
๐จ Installation
-
Install the package via Composer:
- Publish the configuration file:
๐ Configuration
Configure your social media credentials in config/larasap.php
:
Detailed Configuration Guide
Telegram Configuration
api_token
: Your Telegram Bot API token from @BotFatherbot_username
: Your bot's username (without @)channel_username
: Target channel username (without @)channel_signature
: Text to be added at the end of each messageproxy
: Enable/disable proxy support (boolean)
X (Twitter) Configuration
consumer_key
: Your X API consumer keyconsumer_secret
: Your X API consumer secretaccess_token
: Your X API access tokenaccess_token_secret
: Your X API access token secret
Facebook Configuration
app_id
: Your Meta App IDapp_secret
: Your Meta App Secretdefault_graph_version
: Facebook Graph API version (default: v19.0)page_access_token
: Your Facebook Page Access Tokenpage_id
: Your Facebook Page IDenable_beta_mode
: Enable beta features (default: false)debug_mode
: Enable detailed logging (default: false)
Environment Variables
You can also set these values in your .env
file:
Configuration Validation
The package validates all configuration values on initialization. If any required values are missing or invalid, it will throw an exception with a descriptive message.
Configuration Caching
For better performance, the package caches the configuration values. If you need to refresh the configuration, you can clear the Laravel configuration cache:
๐น Usage
First, add the following to your controller:
Telegram Examples
Basic Text Message
Text Message with Inline Keyboard
Send Photo with Caption
Send Audio File
Send Video with Thumbnail
Send Document
Send Location
X (Twitter) Examples
Basic Tweet
Tweet with Media
Reply to Tweet
Quote Tweet
Create Poll
Tweet with Location
Facebook Examples
Share Link with Custom Message
Share Photo with Caption
Share Video with Metadata
Share with Custom Privacy Settings
Share with Targeting
๐ Security Features
- SSL verification enabled by default
- Proxy support with authentication
- Secure API token handling
- Rate limiting protection
- Input validation and sanitization
- Error handling with custom exceptions
โก Performance Features
- Connection timeout: 10 seconds
- Request timeout: 30 seconds
- Automatic JSON encoding/decoding
- Efficient cURL usage
- Retry mechanism with exponential backoff
- Rate limit handling
๐งช Testing
The package includes comprehensive test coverage:
- Unit tests for all components
- Feature tests for integration
- Mock responses for API calls
- Test mode for development
๐งช Testing Routes
To test the social media posting functionality, you can create your own routes in your Laravel application. Here's an example:
-
Create a controller:
-
Add the following code to your controller:
- Add the route in your
routes/web.php
:
Now you can test the social media posting by visiting /test-social-posting
in your browser.
Note: Make sure you have configured your social media credentials in config/larasap.php
or your .env
file before testing.
๐ Notes
- All methods support test mode for development
- Message length limits are enforced (4096 chars for text, 1024 for captions)
- Proxy configuration is optional but validated when provided
- Debug mode available for Facebook API
- Beta mode support for testing new features
๐ฉ Roadmap
- [ ] Improve test coverage
- [ ] Add support for more social media platforms
- [ ] Implement queue system for better performance
- [ ] Add support for story posting
- [ ] Implement analytics tracking
- [ ] Add support for carousel posts
- [ ] Implement bulk posting features
๐ License
This package is open-sourced software licensed under the MIT license.
License Terms
The MIT License is a permissive license that is short and to the point. It lets people do anything they want with your code as long as they provide attribution back to you and don't hold you liable.
What you can do with this package:
- โ Use it commercially
- โ Modify it
- โ Distribute it
- โ Use it privately
- โ Sublicense it
What you must do:
- โ Include the original copyright notice
- โ Include the license text
What you cannot do:
- โ Hold the author liable
- โ Use the author's name/trademarks without permission
Copyright Notice
Third-Party Licenses
This package uses several third-party libraries:
- dg/twitter-php - MIT License
- facebook/graph-sdk - MIT License
- illuminate/support - MIT License
For more information about third-party licenses, please see the composer.json file.
๐ฅ Contributing
We welcome contributions to Laravel Social Auto Posting! Here's how you can help:
Development Setup
- Fork the repository
-
Clone your fork:
-
Install dependencies:
- Create a new branch for your feature:
Coding Standards
- Follow PSR-12 coding standards
- Add type hints and return types where possible
- Write meaningful commit messages following conventional commits
- Add tests for new features
- Update documentation for any changes
Testing
-
Run the test suite:
- Run with coverage report:
Pull Request Process
- Update the README.md with details of changes if needed
- Update the CHANGELOG.md with your changes
- The PR will be merged once you have the sign-off of at least one other developer
Commit Messages
- Use the present tense ("Add feature" not "Added feature")
- Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
- Limit the first line to 72 characters or less
- Reference issues and pull requests liberally after the first line
- Consider starting the commit message with an applicable emoji:
- ๐จ
:art:
when improving the format/structure of the code - ๐
:racehorse:
when improving performance - ๐ฑ
:non-potable_water:
when plugging memory leaks - ๐
:memo:
when writing docs - ๐
:bug:
when fixing a bug - ๐ฅ
:fire:
when removing code or files - ๐
:green_heart:
when fixing the CI build - โ
:white_check_mark:
when adding tests - ๐
:lock:
when dealing with security - โฌ๏ธ
:arrow_up:
when upgrading dependencies - โฌ๏ธ
:arrow_down:
when downgrading dependencies
- ๐จ
Reporting Issues
- Use the issue tracker
- Describe the bug with a clear and descriptive title
- Include steps to reproduce the issue
- Include screenshots if applicable
- Include your environment details (PHP version, Laravel version, etc.)
Feature Requests
- Use the issue tracker
- Describe the feature with a clear and descriptive title
- Explain why this feature would be useful
- Include any relevant use cases
Security
- Report security issues to [email protected]
- Do not disclose security-related issues publicly until a fix has been announced
Code of Conduct
By participating in this project, you agree to abide by our Code of Conduct.
๐ค Support
If you encounter any issues or have questions, please open an issue on GitHub.
๐ Development and Testing
Example Project
This package includes a Laravel 12 example project in the examples/laravel-12
directory that you can use for development and testing. This setup is particularly useful for:
- Testing new features
- Debugging issues
- Contributing to the package
- Understanding package usage
- Developing custom integrations
Setting Up the Development Environment
-
Clone the repository:
-
Set up the example project:
-
Configure your social media credentials in
.env
: -
Link the package for development:
- Start the development server:
Debugging
The example project includes VS Code debugging configurations in .vscode/launch.json
for:
- Debugging the Laravel application
- Debugging the Larasap package
- Debugging Laravel tests
To use the debugger:
- Install the PHP Debug extension in VS Code
- Set breakpoints in your code
- Select the appropriate debug configuration
- Start debugging (F5)
Contributing
When contributing to the package:
- Use the example project to test your changes
- Ensure all tests pass
- Follow the existing code style
- Update documentation as needed
- Submit a pull request with a clear description of your changes