Download the PHP package yannkuesthardt/laravel-spamprotect without Composer

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

Laravel SpamProtect

Latest Version on Packagist Total Downloads License GitHub Build Status

Laravel SpamProtect is a simple package, that encrypts email addresses and phone numbers to protect them against unwanted crawlers and spam.

It encrypts the target of your link and uses JS to decrypt it on the client side. This way, the email address is not visible in the HTML source code and can't be crawled by bots reading hrefs.

Additionally, some common chars used in e-mail addresses and phone numbers are replaced with HTML entities to make it even harder for bots to crawl.

Security Note: Do not use this extension to pass sensitive data to the frontend. The encryption is only meant to stop crawlers and can easily be circumvented by a human.

Installation

Requirements

Getting Started

You can install the package via composer:

Run the installation command to generate a new encryption key and clear necessary caches.

Add the following two blade directives somewhere in your HTML body tag.

Hint: Optionally you can override the default path to the JavaScript file: @spamprotectJs('your/custom/path/to/spamprotect/spamprotect.js')

Upgrade

Upgrade from v1 to v2

A few things have changed since version 1, so please read this carefully to avoid any issues.

If you used v1 in the past, you needed to publish our JavaScript to be accessible via @spamprotectJs. We have now added routing to the package, so you can just use @spamprotectJs without publishing our JavaScript first. If you have set a custom path via the blade directive or the config, remove it to get the default JavaScript via route. You may have to republish the config file, depending on your setup.

Additionally, in v1 you needed to install CryptoJS and require it in your own JavaScript first. As CryptoJS has been discontinued and most browsers offer native support with tools such as Crypto, we have rebuilt this extension to work with native JavaScript. For our new JavaScript to work either use @spamprotectJs without any custom path to access the new routing to our default JavaScript or republish the JavaScript file yourself. If not used anywhere else in your project feel free to completely remove CryptoJS.

Usage

E-Mail Address

To encrypt an email address use the following blade component:

This will result in the following HTML code:

Phone Number

To encrypt a phone number use the following blade component:

This will result in the following HTML code:

Custom Text

You can also use a custom text for the link:

This will result in the following HTML code:

Attributes

You can add HTML attributes (e.g. class, id, etc.) to the generated code by passing them to the components.

This will result in the following HTML code:

Customization

You can generate a new encryption key using:

You can publish the config using:

In the config you can customize the URL used for the default JavaScript or override the path completely.

You can publish the assets (javascript) using:

You can publish the views using

Contributing

Feel free to suggest changes, ask for new features or fix bugs yourself. We're sure there are a lot of improvements that could be made, and we would be very happy to merge useful pull requests. Thanks!

Testing

PHPUnit

PHPStan

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Changelog

Please see CHANGELOG for more information on what has changed recently.

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-spamprotect with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
ext-openssl Version *
ext-json Version *
laravel/framework Version ^10.0|^11.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 yannkuesthardt/laravel-spamprotect contains the following files

Loading the files please wait ....