# Getting Started

### Install:

Use composer to install

```php
composer require mitmelon/guard-power
```

### Usage :

```php
require_once __DIR__."/vendor/autoload.php";

// Place GuardPower Class untop of your application
$guardPower = new GuardPower();
$guardPower->init();
//Your Application Code Here

//If global filter is on just accept your post or get request without filtering
$email = $_POST['email'] // This is save because it has been filtered.

//Do other things.
```

### Properties Setup:

You can change GuardTor properties by calling it before calling the init() method.

```php
//Allow GuardTor to create or modify .htaccess with added functionalities to prevent bad bots
//Default is false.
//Please make sure you only enable this on development for one request to prevent over-writeups
//Once request is complete from your browser, change $guardPower->createhtaccess = false;
//On production change to $guardPower->createhtaccess = false;
$guardPower->createhtaccess = true;
//Never block tor users
//Default is true.
$guardPower->blocktor = false;
//Set the block page url users will be redirected to once blocked
//Default is __DIR__.'/error.html';
$guardPower->blockLink = 'BLOCK_PAGE_URL';
//Prevent request block once limit is reached
//Default is true;
//Please note that setting this to true requires redis installed.
$guardPower->block_request = false;
//Set request limit per minute to reach before blocking request
//This could be used to prevent DDOS Attacks
//Default is 100 times per minutes
$guardPower->attempt = 100;
//Switch off global filter
//We dont recommend switching it off
$guardPower->globalFillter = false;
```

### Other Methods:

Methods to use for strings sanitizations, retrieve IP address and get device info.

```php
/**
 * Validate IPV4 and IPV6 address
 * @param $ip string
 * @return boolean || string
 */
$guardPower->validate_ip($ip);
/**
 * Get device ID from every request including device fingerprint
 * @return array
 */
$guardPower->getDeviceInfo();
/**
 * Get request IP Address
 * @return string
 */
$guardPower->get_ip();
/**
 * Advance cleaning of strings from user inputs
 * @param $value string to clean
 * @return string
 */
$guardPower->strip($value);
/**
 * Clean html inputs to prevent xss attacks
 * @param $html string to clean
 * @return string
 */
$guardPower->filterHtml($html);
```

### Future Updates :

* Spam Detections/Blocker

## License

Released under the MIT license.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://manomitehq.gitbook.io/guardtor/getting-started.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
