https://github.com/fschirinzi/laramote
LaraMote allows you to run tasks in Laravel from remote (REST API). This package is helpful for E2E testing.
https://github.com/fschirinzi/laramote
cypress e2e e2e-test laravel test
Last synced: 6 months ago
JSON representation
LaraMote allows you to run tasks in Laravel from remote (REST API). This package is helpful for E2E testing.
- Host: GitHub
- URL: https://github.com/fschirinzi/laramote
- Owner: fschirinzi
- License: mit
- Created: 2022-01-08T16:14:02.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-01-17T10:42:34.000Z (over 4 years ago)
- Last Synced: 2025-05-14T23:44:37.495Z (about 1 year ago)
- Topics: cypress, e2e, e2e-test, laravel, test
- Language: PHP
- Homepage:
- Size: 45.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
Awesome Lists containing this project
README
# Remote for Laravel
[](https://github.com/fschirinzi/translation-manager-for-laravel/actions?query=workflow%3ATests)
[](https://github.styleci.io/repos/445867028)
[](https://packagist.org/packages/fschirinzi/laramote)
[](https://packagist.org/packages/fschirinzi/laramote)
LaraMote allows you to run tasks in Laravel from remote. This package is helpful if you are testing
your frontend (SPA) application with [Cypress](https://www.cypress.io/) that uses a Laravel application as backend.
At the moment, these features are implemented:
:white_check_mark: Artisan command
:white_check_mark: Command with parameters
:white_check_mark: Get Output
:white_check_mark: Login User
:white_check_mark: Custom key value
:white_check_mark: Custom key/table column
:white_check_mark: Custom model
:white_check_mark: Remember
:white_check_mark: Factory
:white_check_mark: Make/Create
:white_check_mark: Models
:white_check_mark: Name
:white_check_mark: States
:white_check_mark: Amount
:white_check_mark: Show hidden attributes
:white_check_mark: Override attributes
:white_check_mark: Model
:white_check_mark: Search with custom key value
:white_check_mark: Search with custom key/table column
:white_check_mark: Search with custom model
:white_check_mark: Get with limit
:white_check_mark: Load relationships
:white_check_mark: Show hidden attributes for model and relationships
**TODO**
- [ ] Make Commands working
- [ ] Make Tests
- [ ] Add wiki page with all endpoints and their parameters
- [ ] Support all class based factory features
## Installation
| Version | Supported Factories |
| --- | --- |
| v0.\*, v1.\* | Legacy Factories |
| v2.\* | Class based factories
You can install the package via composer:
```bash
composer require fschirinzi/laramote --dev
```
After installing LaraMote, you *may* publish its assets using the `laramote:install` Artisan command:
```bash
php artisan laramote:install
```
## Usage
LaraMote exposes the endpoints at the `/laramote` URI.
By default, you will only be able to access this dashboard in the `local` and `testing` environment.
However, within your `app/Providers/LaraMoteServiceProvider.php` file, there is a gate method
that controls access to the LaraMote endpoints in non-local environments.
You are free to modify this gate as needed to restrict access to your LaraMote endpoints:
``` php
/**
* Register the LaraMote gate.
*
* This gate determines who can access LaraMote in non-local environments.
*
* @return void
*/
protected function gate()
{
Gate::define('useLaraMote', function ($user = null) {
return in_array(optional($user)->email, [
//
]);
});
}
```
### Examples
You can import `Insomnia_example_requests.json` into the [Insomnia Rest-client](https://insomnia.rest/) to see some examples in action.
## Upgrading
When upgrading to a new version of Laramote, you should re-publish LaraMote's assets:
```bash
php artisan laramote:publish
```
To keep the assets up-to-date and avoid issues in future updates, you may add the
laramote:publish command to the post-update-cmd scripts in your application's composer.json file:
## Customizing Middleware
If needed, you can customize the middleware stack used by LaraMote routes by updating your
`config/laramote.php` file. If you have not published LaraMote's configuration file, you may
do so using the vendor:publish Artisan command:
``` bash
php artisan vendor:publish --tag=laramote-config
```
Once the configuration file has been published, you may edit LaraMote's
middleware by tweaking the middleware configuration option within this file:
``` php
/*
|--------------------------------------------------------------------------
| LaraMote Route Middleware
|--------------------------------------------------------------------------
|
| These middleware will be assigned to every Vapor UI route - giving you
| the chance to add your own middleware to this list or change any of
| the existing middleware. Or, you can simply stick with this list.
|
*/
'middleware' => [
'api',
EnsureUserIsAuthorized::class,
],
```
## Testing
``` bash
composer test
```
## Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
## Security
If you discover any security related issues, please email fschirinzi25@gmail.com instead of using the issue tracker.
## Credits
- [Francesco Schirinzi](https://github.com/fschirinzi)
- [All Contributors](../../contributors)
I used the [Laravel/VaporUi](https://github.com/laravel/vapor-ui) package
and their [documentation](https://docs.vapor.build/1.0/introduction.html#installing-the-vapor-core)
as template to speed up the development of this package.
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
## Laravel Package Boilerplate
This package was generated using the [Laravel Package Boilerplate](https://laravelpackageboilerplate.com).