wm / wm-package
Webmapp laravel wm-package
Installs: 3 298
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 4
Forks: 1
Open Issues: 5
Requires
- php: >8.1
- illuminate/contracts: >10.0
- kiritokatklian/nova-permission: *
- laravel/nova: ^4.0 <=4.33.3
- laravel/sanctum: *
- maatwebsite/excel: ^3.1
- spatie/laravel-package-tools: >1.16
- spatie/laravel-permission: *
- tymon/jwt-auth: >2.0
Requires (Dev)
- guzzlehttp/guzzle: ^7.9
- larastan/larastan: ^3.0
- laravel/pint: ^1.14
- nunomaduro/collision: *
- orchestra/testbench: *
- pestphp/pest: ^2.34
- pestphp/pest-plugin-arch: ^2.7
- pestphp/pest-plugin-laravel: ^2.3
- phpstan/extension-installer: *
- phpstan/phpstan-deprecation-rules: ^2.0
- phpstan/phpstan-phpunit: ^2.0
- dev-main
- v1.3.1
- v1.3.0
- v1.2.6
- v1.2.5
- v1.2.4
- v1.2.3
- v1.2.2
- v1.2.1
- 1.1
- 1.0
- dev-app_id_relation
- dev-feat/UgcControllersTests
- dev-develop
- dev-new-tests
- dev-update_nova_map_fields
- dev-refactor_aws_dumps
- dev-add_foreign_keys_to_ugcs_and_medias
- dev-ugc_nova_resources
- dev-tests
- dev-release-please--branches--develop
- dev-fix/phpstan
- dev-feat/user-abstraction
- dev-edit_field_action
- dev-feature/20220212_piccioli_area
This package is auto-updated.
Last update: 2025-02-20 13:09:22 UTC
README
This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.
Installation
You can install the package via composer:
composer require wm/wm-package
You can publish and run the migrations with:
php artisan vendor:publish --tag="wm-package-migrations"
php artisan migrate
Available migrations are:
create_jobs_table
, for default laravel job with an extra columncreate_hoqu_caller_jobs
, HoquCallerJob model table, necessary for processor/caller instances
You can publish the config file with :
php artisan vendor:publish --tag="wm-package-config"
This is the contents of the published config file :
return [ 'hoqu_url' => env('HOQU_URL', 'https://hoqu2.webmapp.it'), 'hoqu_register_username' => env('HOQU_REGISTER_USERNAME'), 'hoqu_register_password' => env('HOQU_REGISTER_PASSWORD ') ];
Usage
use Wm\WmPackage\Facades\HoquClient; /** Start store call to hoqu (1)**/ HoquClient::store(['name' => 'test','input' => '{ ... }' ]); ... /** It logins (to retrieve a token) as an user that can create processors/callers on hoqu **/ HoquClient::registerLogin() ... /** Register a new processor/caller on hoqu **/ HoquClient::register()
Update
You can update the package via composer:
composer update wm/wm-package
Testing
composer test
Developing
If you need this package on full laravel instance you have to add this repository as submodule in the root path of Laravel with git submodule add {git repo}
, then add a new composer path repository in the laravel composer.json
file:
"repositories": [ { "type": "path", "url": "./wm-package" } ]
at last you can install the package with compose require wm/wm-package
Testing
These tools are used to test the stand alone instance of wm-package: https://packages.tools/
Execute these commands to runs tests:
./vendor/bin/testbench migrate
It migrates workbench tables on a sqlite database located in a vendor folder. Phpunit will use this database as tests memory support.
./vendor/bin/pest
To run tests.
If an evaluation of testbench env I suggest to use the config()
function (eg: config('database.connections.sqlite')
) with the testbench implementation of tinker ./vendor/bin/testbench tinker
, it is also useful to understand which things are loaded on the testbench env.
Testbench reference: https://packages.tools/testbench.html Workbench reference: https://packages.tools/workbench.html
Also a simple php docker container is available to run tests, you can start it using docker compose up -d
and enter inside with docker compose exec -it php bash
or directly docker compose exec -it php ./vendor/bin/pest
(check permissions on files before run it, if you have problems use the -u
param on exec command with the id of the user who owns project files and directories, to check your current user id you can use the command id
).
Pushing
We use git flow to add features to this repo. Please create a new feature then push it and ask a pull request via github interface from your feature branch to develop.
Run ./vendor/bin/phpstan
before push to evaluate errors
License
The MIT License (MIT). Please see License File for more information.
Docs
https://github.com/spatie/laravel-package-tools
https://laravel.com/docs/9.x/facades#facades-vs-dependency-injection
Default private/public routes (powered by Sanctum )
- public routes
POST /login
: consente la login tramite parametriemail
epassword
in formatox-www-form-urlencoded
- private routes
POST /logout
consente la logout tramite Bearer tokenGET /user
restituisce i dettagli dell'utente loggato tramite Bearer token
Artisan commands
hoqu:register-user
. Create a new user on Hoqu instance based on credetials provided in.env
file. Options:--R|role
: required, the role of this instance: "caller" , "processor" or "caller,processor"--endpoint=false
: the endpoint of this instance, default isAPP_URL
in .env file
hoqu:store
. Performs a call to Hoqu to store a job, saves a newHoquCallerModel
in the database with the hoqu response. Options:--class
: required, the class that will execute job on processor}--featureId
: required, the feature id to update after completed job}--field
: required, the field to update after completed job}--input
: required, the input to send to processor}
db:upload_db_aws
. Uploads the given sql file and the last-dump of the database to AWS. only from production Arguments:dumpname?
: the name of the sql zip file to upload
db:download
. download a dump.sql from server in storage/app/database folder. Has no arguments:
JWT
JWT verrĂ installato automaticamente come dipendenza. Gli utenti dovranno solo:
- Eseguire
composer require wm/wm-package
- Pubblicare la configurazione JWT con
php artisan vendor:publish --tag="wm-package-jwt-config"
- Configurare le variabili d'ambiente JWT nel file .env utilizzando il comando
php artisan jwt:secret
Il pacchetto JWT sarĂ gestito come dipendenza del wm-package invece che dover essere installato separatamente nell'applicazione principale.