Stores
When your crawler finally collected a lot of data, you'll
probably want to store it. A convenient way to do this are
stores. Just make your own store class implementing the
StoreInterface
and add it to your crawler. The crawler
will then automatically call the store()
method of your
store class with every Result
object.
use Crwlr\Crawler\Result;
use Crwlr\Crawler\Stores\StoreInterface;
class MyStore implements StoreInterface
{
public function store(Result $result): void
{
// Store the Result however you prefer.
}
}
And where you're defining your crawling procedure:
$myCrawler->setStore(new MyStore());
The package ships with a very, very simple store class,
the SimpleCsvFileStore
. It will store your results in a
CSV file.