Download the PHP package dost-tapi/portal-integration without Composer

On this page you can find all versions of the php package dost-tapi/portal-integration. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package portal-integration

DOST-TAPI Portal Integration Package

A Laravel package that provides SSO (Single Sign-On) and role management integration for DOST-TAPI applications using Spatie Laravel Permission.

Features

Requirements

Installation

Install the package via Composer:

Publish Configuration

Publish the configuration file:

This will create a config/portal-integration.php file.

Publish Migrations

Publish the migration file:

Then run the migration:

This adds the following columns to your users table:

Configuration

Add the following environment variables to your .env file:

Configuration Options

Variable Description Default
PORTAL_API_KEY Unique API key for authenticating requests from Portal null (required)
PORTAL_URL Base URL of the Portal application http://portal-app
PORTAL_USER_MODEL User model class for your application \App\Models\User
PORTAL_AUTO_CREATE_USERS Automatically create users during SSO true
PORTAL_DEFAULT_ROLE Default role assigned to new SSO users viewer

Usage

API Endpoints

The package automatically registers the following API endpoints:

1. Get Roles

Endpoint: GET /api/roles

Description: Returns all roles with their permissions for Portal synchronization.

Authentication: Requires Portal API key as Bearer token

Request Example:

Response Example:

2. Create/Update User

Endpoint: POST /api/admin/create-user

Description: Creates or updates a user with role assignment from Portal.

Authentication: Requires Portal API key as Bearer token

Request Body:

Response Example:

Error Response (Role not found):

3. Update User Role

Endpoint: PUT /api/admin/update-user-role/{portal_user_id}

Description: Updates an existing user's role.

Authentication: Requires Portal API key as Bearer token

Request Body:

Response Example:

Error Response (User not found):

SSO Middleware

Protect routes with SSO authentication using the portal.sso middleware:

The middleware will:

  1. Extract the SSO token from query parameter (?token=...) or Bearer token
  2. Validate the token with the Portal API
  3. Create or update the user in your application
  4. Authenticate the user
  5. Continue the request

SSO Flow Example:

API Key Middleware

The portal.api middleware is automatically applied to all package routes. You can also use it on custom routes:

Artisan Commands

Sync Roles to Portal

Synchronize your application's roles and permissions to the Portal:

Output Example:

This command:

You can run this command:

Testing

The package includes comprehensive tests. To run tests:

Test Coverage

The package includes tests for:

API Reference

Response Format

All endpoints return JSON responses with consistent format:

Success Response:

Error Response:

HTTP Status Codes

Code Description
200 Success (GET, PUT)
201 Created (POST)
400 Bad Request (Invalid role, etc.)
401 Unauthorized (Invalid API key)
404 Not Found (User not found)
422 Validation Error
500 Server Error

Authentication

All API endpoints require authentication via Bearer token:

The API key is configured in PORTAL_API_KEY environment variable.

Security

Troubleshooting

Common Issues

Issue: API key authentication fails

Solution:


Issue: SSO token validation fails

Solution:


Issue: Role not found error

Solution:


Issue: Migration fails

Solution:


Issue: Users not being created via SSO

Solution:

Docker Integration

When using Docker, use internal container URLs for PORTAL_URL:

Package Installation Methods

Via GitHub Repository

Add to composer.json:

Via Local Path (Development)

Add to composer.json:

Then run:

Logging

The package logs important events:

Logs are written to Laravel's default log channel (storage/logs/laravel.log).

Support

For issues, questions, or contributions:

License

MIT License. See LICENSE file for details.

Credits

Developed by the DOST-TAPI Development Team.

Changelog

Version 1.0.0


All versions of portal-integration with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/support Version ^10.0|^11.0|^12.0
illuminate/http Version ^10.0|^11.0|^12.0
illuminate/database Version ^10.0|^11.0|^12.0
spatie/laravel-permission Version ^6.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package dost-tapi/portal-integration contains the following files

Loading the files please wait ...