A Laravel PHP client package for connecting your Laravel application to Vaia (formerly StudySmarter) accounts.
StudySmarter for Laravel provides a seamless bridge between your Laravel application and Vaia accounts. This package enables you to integrate Vaia's powerful learning platform features directly into your Laravel applications, allowing users to access their study materials, track learning progress, and synchronize data between platforms.
- User Authentication - Secure authentication with Vaia accounts using API keys
- Study Materials Access - Fetch and manage study materials, flashcards, and learning content
- Progress Tracking - Monitor and retrieve user learning progress and statistics
- Data Synchronization - Sync study data between your Laravel application and Vaia
- Configurable Retry Logic - Built-in retry mechanism for handling network issues
- Comprehensive Logging - Optional request/response logging for debugging
- SSL Verification - Secure communication with configurable SSL settings
- PHP 8.1 or higher
- Laravel 10.0 or higher (supports Laravel 11.0)
Install the package via Composer:
composer require automatape2/vaia-php-clientThe package will automatically register its service provider through Laravel's package discovery.
Optionally, you can publish the configuration file:
php artisan vendor:publish --provider="Automatape2\VaiaPhpClient\VaiaPhpClientServiceProvider"After installation, configure your Vaia API connection by adding the following environment variables to your .env file:
# Required
VAIA_API_KEY=your-api-key-here
# Optional - API Settings
VAIA_BASE_URL=https://api.vaia.com
VAIA_TIMEOUT=30
VAIA_CONNECT_TIMEOUT=10
# Optional - Retry Configuration
VAIA_RETRY_TIMES=3
VAIA_RETRY_SLEEP=100
# Optional - Logging
VAIA_LOGGING_ENABLED=false
VAIA_LOG_CHANNEL=
# Optional - SSL Configuration
VAIA_VERIFY_SSL=true| Option | Description | Default |
|---|---|---|
VAIA_API_KEY |
Your Vaia API key (required) | null |
VAIA_BASE_URL |
Base URL for the Vaia API | https://api.vaia.com |
VAIA_TIMEOUT |
Request timeout in seconds | 30 |
VAIA_CONNECT_TIMEOUT |
Connection timeout in seconds | 10 |
VAIA_RETRY_TIMES |
Number of retry attempts | 3 |
VAIA_RETRY_SLEEP |
Milliseconds between retries | 100 |
VAIA_LOGGING_ENABLED |
Enable request/response logging | false |
VAIA_LOG_CHANNEL |
Log channel to use | null (uses Laravel default) |
VAIA_VERIFY_SSL |
Verify SSL certificates | true |
Note: The following examples demonstrate common usage patterns. Refer to the API documentation for the complete list of available methods.
use Automatape2\VaiaPhpClient\Facades\Vaia;
// Authenticate and verify connection
$authenticated = Vaia::authenticate();
if ($authenticated) {
// Connection successful
}use Automatape2\VaiaPhpClient\Facades\Vaia;
// Get all study sets for the authenticated user
$studySets = Vaia::getStudySets();
// Get a specific study set by ID
$studySet = Vaia::getStudySet($studySetId);
// Get flashcards from a study set
$flashcards = Vaia::getFlashcards($studySetId);use Automatape2\VaiaPhpClient\Facades\Vaia;
// Get user profile information
$profile = Vaia::getUserProfile();
// Get learning progress statistics
$progress = Vaia::getProgress();
// Sync local data with Vaia
$syncResult = Vaia::sync($localData);use Automatape2\VaiaPhpClient\VaiaClient;
class StudyController extends Controller
{
public function __construct(
protected VaiaClient $vaia
) {}
public function index()
{
$studySets = $this->vaia->getStudySets();
return view('study.index', compact('studySets'));
}
}Contributions are welcome! Please follow these guidelines:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Run the tests (
composer test) - Run the code formatter (
composer format) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
# Clone the repository
git clone https://github.com/automatape2/vaia-php-client.git
# Install dependencies
composer install
# Run tests
composer test
# Format code
composer formatThis package is open-sourced software licensed under the MIT license.
- Issues: Report bugs or request features via GitHub Issues
- Discussions: For questions and discussions, use GitHub Discussions
- Email: Contact the maintainer at automatape2@users.noreply.github.com
Made with ❤️ for the Laravel community