Skip to content

Commit

Permalink
exemples
Browse files Browse the repository at this point in the history
  • Loading branch information
Mediashare committed Dec 21, 2019
1 parent 6a20ec5 commit 9e634b7
Show file tree
Hide file tree
Showing 10 changed files with 85 additions and 129 deletions.
80 changes: 0 additions & 80 deletions PACKAGIST.md

This file was deleted.

19 changes: 0 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,6 @@ Use Spider library in your project & create your own modules.
```bash
composer require mediashare/spider
```
#### Github
```bash
git clone https://github.com/Mediashare/Spider
cd Spider
composer install
```
#### Docker
```bash
docker pull slote/spider
docker run slote/spider php exemple.com
```

# Packagist Version
## Installation
```bash
composer require mediashare/spider
```

## Usage
### Create index.php file and init the config.
Expand All @@ -65,8 +48,6 @@ $config->setVerbose(true); // Prompt verbose output
$config->setJson(false); // Prompt json output
// Modules Activation
$config->enableAllModule(true); // Enable all modules
// Modules Activation
$config->enableAllModule(true); // Enable all modules
// $config->addModules(['Links', 'Search']);// Select one or more modules to use with class name

// Url
Expand Down
28 changes: 0 additions & 28 deletions exemple.php

This file was deleted.

13 changes: 13 additions & 0 deletions exemples/console.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php
require 'vendor/autoload.php';
use Tracy\Debugger;
Debugger::enable();

$config = new \Mediashare\Entity\Config(); // Website Config
$config->setVerbose(true); // Prompt verbose output
// Url
$url = new \Mediashare\Entity\Url('http://marquand.pro');

// Spider
$spider = new \Mediashare\Spider($url, $config);
$result = $spider->run();
13 changes: 13 additions & 0 deletions exemples/json-http-response.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php
require 'vendor/autoload.php';
use Tracy\Debugger;
Debugger::enable();

// Config
$config = new \Mediashare\Entity\Config();
$config->setJson(true); // Prompt json response
// Url
$url = new \Mediashare\Entity\Url('http://marquand.pro');
// Spider
$spider = new \Mediashare\Spider($url, $config);
$result = $spider->run();
15 changes: 15 additions & 0 deletions exemples/module-selection.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
require 'vendor/autoload.php';
use Tracy\Debugger;
Debugger::enable();

$config = new \Mediashare\Entity\Config();
$config->addModules(['Links', 'Metadata']); // Select one or more modules to use with class name

// Url
$url = new \Mediashare\Entity\Url('http://marquand.pro');

// Spider
$spider = new \Mediashare\Spider($url, $config);
$result = $spider->run();
// var_dump($result);
15 changes: 15 additions & 0 deletions exemples/require.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
require 'vendor/autoload.php';
use Tracy\Debugger;
Debugger::enable();

$config = new \Mediashare\Entity\Config(); // Website Config
$config->setRequires(['/images/', '/tags/']); // Path requires

// Url
$url = new \Mediashare\Entity\Url('http://marquand.pro');

// Spider
$spider = new \Mediashare\Spider($url, $config);
$result = $spider->run();
// var_dump($result);
28 changes: 28 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php
require 'vendor/autoload.php';
// use Tracy\Debugger;
// Debugger::enable();

$config = new \Mediashare\Entity\Config(); // Website Config
$config->setId("Audit_marquand.pro"); // Id|Name report (uniqid() by default)
$config->setWebspider(true); // Crawl all website
$config->setRequires(['/projet']); // Path requires
// $config->setExceptions(['/contact']); // Path exceptions
// Directories
$config->setReportsDir(__DIR__.'/reports/'); // Default reports path
$config->setModulesDir(__DIR__.'/modules/'); // Default modules path
// Prompt Console / Dump
$config->setVerbose(true); // Prompt verbose output
$config->setJson(false); // Prompt json output
// Modules Activation
$config->enableAllModule(false); // Enable all modules
$config->addModules(['Links', 'Search', 'Metadata']);// Select one or more modules to use with class name
$config->addVariables(['Search' => ['ces deux exchanges']]); // Inject this variables in modules

// Url
$url = new \Mediashare\Entity\Url('http://marquand.pro');

// Spider
$spider = new \Mediashare\Spider($url, $config);
$result = $spider->run();
// var_dump($result);
2 changes: 1 addition & 1 deletion src/Service/Output.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function progressBar(int $counter, int $max_counter, ?string $message) {
public function fileDirection(string $file_direction) {
if ($this->config->getVerbose()) {
$climate = new \League\CLImate\CLImate;
$climate->clear();
// $climate->clear();
$climate->border('-*-', 50)->animation('right');
echo $this->echoColor("* Output file result: ",'white').$this->echoColor($file_direction."\xA",'green');
$climate->border('-*-', 50);
Expand Down
1 change: 0 additions & 1 deletion src/Spider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
use Mediashare\Entity\Url;
use Mediashare\Entity\Config;
use Mediashare\Controller\Webspider;
session_start();

class Spider
{
Expand Down

0 comments on commit 9e634b7

Please sign in to comment.