iankibet / laravel-streamline
A package that allows front end to interact with backend without the need for routes and controller
Installs: 1 136
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
- dev-main
- 1.1.5
- 1.1.4
- 1.1.3
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.9
- 1.0.8
- 1.0.7
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.0
- dev-auth-middleware
- dev-validation
- dev-component-testing
- dev-model-migration-seeder-permission
- dev-validated-hook
- dev-document-validation-testing
- dev-component-test
- dev-testing
- dev-fix-environment
- dev-3-how-do-i-implement-it-in-my-services
- dev-permissions
- dev-publishable-config
This package is auto-updated.
Last update: 2025-02-28 07:21:27 UTC
README
Overview
A laravel package that makes it possible to bind service/streamline class to frontend vue component
Installation
composer require iankibet/laravel-streamline
Config
Streamline uses a config file to determine the namespace of the service/streamline classes. To publish the config file, run the following command:
php artisan vendor:publish --tag=laravel-streamline
Here is how the config file looks like:
return [ 'class_namespace' => 'App\\Streams', 'class_postfix' => 'Stream', 'route' => 'api/streamline', 'middleware' => ['auth:sanctum'], 'guest_streams' => [ 'auth/auth' ] ];
Modify the values to suit your application.
class_namespace
This is the namespace where the stream classes are located. The default value is App\Streams
.
class_postfix
This is the postfix that is added to the stream class to easily identify streamline . The default value is Stream
. For example, if the Stream name is User
, the stream class will be UsersStream
.
guest_streams
This is an array of streams that can be accessed without authentication. The default value is ['auth/auth']
.
Implementation
To use, first import the Stream and extend it in yur class as show below:
use iankibet\Streamline\Stream; class TasksStreamline extends Stream { }
Validation
To validate, use Validate attribute as shown below:
use iankibet\Streamline\Stream; use iankibet\Streamline\Validate; // in the method #[Validate([ 'name' => 'required|string', 'description' => 'required|string' ])] public function addTask() { // code here $data = $this->only(['name', 'description']); } }
Permission Authorization
To authorize, use Permission attribute as shown below:
use iankibet\Streamline\Component; use iankibet\Streamline\Permission; // in the method #[Permission('create-task')] public function addTask() { // code here $data = $this->only(['name', 'description']); } }
Create a new Stream
To create a new Stream, use the following command:
php artisan streamline:stream TasksStream
This will create a new Stream class in the app/Streams
directory.
Testing the Stream
To test the Stream, use the following command: Replace TasksStream
with the name of your streams.
php artisan streamline:test TasksStream