Download the PHP package maize-tech/laravel-nps without Composer

On this page you can find all versions of the php package maize-tech/laravel-nps. 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 laravel-nps

# Laravel NPS [![Latest Version on Packagist](https://img.shields.io/packagist/v/maize-tech/laravel-nps.svg?style=flat-square)](https://packagist.org/packages/maize-tech/laravel-nps) [![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/maize-tech/laravel-nps/run-tests.yml?branch=main&label=tests&style=flat-square)](https://github.com/maize-tech/laravel-nps/actions?query=workflow%3Arun-tests+branch%3Amain) [![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/maize-tech/laravel-nps/php-cs-fixer.yml?branch=main&label=code%20style&style=flat-square)](https://github.com/maize-tech/laravel-nps/actions?query=workflow%3A"Check+%26+fix+styling"+branch%3Amain) [![Total Downloads](https://img.shields.io/packagist/dt/maize-tech/laravel-nps.svg?style=flat-square)](https://packagist.org/packages/maize-tech/laravel-nps) Easily integrate custom-made NPS (Net Promoter Score) to your application. ## Installation You can install the package via composer: You can publish and run the migrations with: You can publish the config file with: This is the contents of the published config file: ## Usage ### Basic To use the package, add the `Maize\Nps\CanAnswerNps` trait to the User model. Here's an example model including the `CanAnswerNps` trait: You can then create one or multiple NPS from the DB or, if you wish, you could handle the creation with a CMS. Here are the fields who should be filled: - **question**: the question that identifies the NPS - **starts_at**: the start date of the NPS - **ends_at**: the end date of the NPS - **range**: the value ranges accepted for the given NPS. This value must be equal to one of the keys defined in the `range` list from `config/nps.php`. Defaults to `default`. - **visibility**: the visibility for the given NPS. This value must be equal to one of the keys defined in the `visibility` list from `config/nps.php`. Defaults to `default`. Let's say we create a NPS which starts on 2021-01-01 and ends after a week: here's the model entity we would have: You can now call the custom API to retrieve, reply or delay the current NPS, which can be customized in `config/nps.php`: #### GET - **/nps** This endpoint retrieves the current NPS using the given criteria: - the `starts_at` date must be earlier than `now()` - the `ends_at` date must be older than `now()` - the NPS must be visible (defaults to `true`) The NPS entries are then filtered by their ends_at date in order to pick the first one expiring. The response contains the NPS id (used for the POST route), the question, and the accepted values. Here is a sample response body: #### POST - **/nps/{id}** This endpoint stores the answer for the given NPS from the currently authenticated user. The request requires the following attributes: - **value**: the value chose by the user - **answer**: the (optional) answer written by the user There are some basic validation rules applied to the request: - the **value** attribute must be an integer - the **value** attribute should be between the range defined in the given NPS model - a user should not be able to submit the answer if **value** is `null` - a user should be able to decline their submission for the NPS. In this case, both **value** and **answer** attributes should be `null` #### POST - **/nps/{id}/delay** This endpoint marks the NPS answered in cache for the currently authenticated user, but only for a limited time. This way, the `hasAnsweredCurrentNps` and `hasAnsweredNps` methods will return `true` even if the answer is not stored in the database. The user will then be able to see again the NPS only after that amount of time has expired. The amount of time (in seconds) can be configured in the `nps_answer_ttl` attribute from `config/nps.php`. ### Custom range class If you wish to define a custom range of values for a NPS, you can define a new class which extends the NpsRange abstract class and contains a `$values` array. You can then associate the class with a name used as identified for the `range` attribute of the NPS model. This can be easily done by adding the key-value pair in the `range` list from `config/nps.php`: You can also define an associative array in case you want the values to be an array of strings. In this case, the key should contain the string, whereas the value is the associated integer which should be sent from the POST endpoint. ### Custom visibility class If you wish to define a custom visibility for a NPS, you can define a new class which extends the NpsVisibility abstract class and implement the `__invoke` abstract method. For example, let's say we want a NPS to be visible for a user when they performed at least 5 logins. Here is the custom visibility class we should have: You can then associate the class with a name used as identified for the `visibility` attribute of the NPS model. This can be easily done by adding the key-value pair in the `visibility` list from `config/nps.php`: ## Testing ## Changelog Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently. ## Contributing Please see [CONTRIBUTING](https://github.com/maize-tech/.github/blob/main/CONTRIBUTING.md) for details. ## Security Vulnerabilities Please review [our security policy](https://github.com/maize-tech/.github/security/policy) on how to report security vulnerabilities. ## Credits - [Enrico De Lazzari](https://github.com/enricodelazzari) - [Riccardo Dalla Via](https://github.com/riccardodallavia) - [All Contributors](../../contributors) ## License The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

All versions of laravel-nps with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/database Version ^10.0|^11.0
illuminate/http Version ^10.0|^11.0
illuminate/routing Version ^10.0|^11.0
illuminate/support Version ^10.0|^11.0
illuminate/validation Version ^10.0|^11.0
spatie/laravel-package-tools Version ^1.14.1
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 maize-tech/laravel-nps contains the following files

Loading the files please wait ....