pacific-softwares / projectscore
A Laravel package for managing common API configuration and services across multiple Pacific Software projects
Installs: 4
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/pacific-softwares/projectscore
Requires
- php: ^7.4|^8.0|^8.1|^8.2|^8.3
- illuminate/config: ^7.0|^8.0|^9.0|^10.0|^11.0|^12.0
- illuminate/http: ^7.0|^8.0|^9.0|^10.0|^11.0|^12.0
- illuminate/support: ^7.0|^8.0|^9.0|^10.0|^11.0|^12.0
Requires (Dev)
- phpunit/phpunit: ^9.0|^10.0
This package is not auto-updated.
Last update: 2026-01-29 12:08:35 UTC
README
A Laravel package for managing common API configuration and services across multiple Pacific Software projects.
Installation
Install the package via Composer:
composer require pacific-softwares/projectscore
Configuration
The package has a default API base URL set to https://api.pacificsoftwares.com/projectscore/api/v1.
You can override this default by setting PROJECTSCORE_API_BASE_URL in your .env file (optional):
PROJECTSCORE_API_BASE_URL=https://your-custom-api-url.com/projectscore/api/v1 PROJECTSCORE_API_KEY=your-api-key-here PROJECTSCORE_API_TIMEOUT=30
If PROJECTSCORE_API_BASE_URL is not set in .env, the package will use its default value.
Publishing Config
To publish the config file (optional):
php artisan vendor:publish --tag=projectscore-config
This will publish the config to config/projectscore.php.
Usage
Using the Facade
use ProjectsCore\Facades\ProjectsCore; // Get the API base URL $baseUrl = ProjectsCore::getBaseUrl(); // Check if API is configured if (ProjectsCore::isConfigured()) { // API is available } // Build a full URL from a path $url = ProjectsCore::url('users/123'); // Make GET request $response = ProjectsCore::get('users', ['page' => 1]); $users = $response->json(); // Make POST request $response = ProjectsCore::post('users', [ 'name' => 'John Doe', 'email' => 'john@example.com' ]); $user = $response->json(); // Make PUT request $response = ProjectsCore::put('users/123', [ 'name' => 'Jane Doe' ]); // Make PATCH request $response = ProjectsCore::patch('users/123', [ 'email' => 'jane@example.com' ]); // Make DELETE request $response = ProjectsCore::delete('users/123');
Using the Service
use ProjectsCore\Services\ApiService; $apiService = app('projectscore.api'); $baseUrl = $apiService->getBaseUrl(); // Make requests $response = $apiService->get('users'); $data = $response->json();
Response Handling
All HTTP methods return an Illuminate\Http\Client\Response instance, which provides various methods:
$response = ProjectsCore::get('users'); // Check if request was successful if ($response->successful()) { $data = $response->json(); } // Get status code $statusCode = $response->status(); // Get response body as array $data = $response->json(); // Get response body as string $body = $response->body(); // Check for errors if ($response->failed()) { // Handle error }
Service Provider
The package is automatically registered via Laravel's package discovery.
License
MIT