2017 © Pedro Peláez
 

library sitetool

Event based site tool and tester.

image

danack/sitetool

Event based site tool and tester.

  • Wednesday, June 13, 2018
  • by Danack
  • Repository
  • 3 Watchers
  • 4 Stars
  • 22 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 1 Open issues
  • 9 Versions
  • 450 % Grown

The README.md

SiteTool

A couple of very simple tools for checking sites and site migration., (*1)

Site crawler

Crawls a site to find all links, and then fetches them. Run with:, (*2)

php cli.php site:crawl http://phpimagick.com/

Reults by default will be written to 'crawl_result.txt'., (*3)

Migration checker

Once a site has been crawled, then you can check to see if the same paths are available on a different domain., (*4)

php -d memory_limit=1280M src/cli.php site:migratecheck phpimagick.com www.phpimagick.com 

This allows you to check that migrating to a new platform hasn't lost any paths., (*5)

Visualizing events

As the whole application is tied together using events, it can be difficult to comprehend how the different parts of the app fit together., (*6)

Appending --graph to any of the commands will make the application generate a graph of how the events + processors are tied together for that command, rather than running the command., (*7)

The graph generation depends on having graphviz available. There is a docker composer file for this project to allow generating graphs inside that, which can be invoked with something like., (*8)

docker-compose up --build

docker exec sitetool_php_1 php cli.php site:crawl http://phpimagick.com/ --graph

If the project is not checked out to a directory named 'sitetool' you may need to run docker ps to find the exact docker image name., (*9)

Naming things

Event names

Event names should be a past tense phrase that described what has happened. Examples:, (*10)

FoundUrl FoundUrlToFetch FoundUrlToSkip
ReceivedHtml ResponseWasOk ResponseWasError ResponseWasReceived, (*11)

Processor names

Processor names should be of the form 'verb' + 'object' or 'verb' + 'object' + 'condition'. If possible use the event name as the object., (*12)

CheckResponseContentTypeIsHtml CheckResponseIsOk FetchUrl LogResponseWasOk LogResponseWasError LogFoundUrlToSkip ParseReceivedHtmlToFindUrls DecideFoundUrlShouldBeFollowed, (*13)

Where it makes sense, use the event name that is being listened for, in the procesor name., (*14)

php phpstan.phar analyze -c ./phpstan.neon -l 7 src, (*15)

The Versions