Git Product home page Git Product logo

al-php-composer-lib's Introduction

Simple PHP Crawler

Project based on Alura PHP Composer course

https://packagist.org/packages/devontherun/simple-php-crawler

Start composer

$ composer init

Install libs


$ composer require guzzlehttp/guzzle # search in https://packagist.org/

symfony/dom-crawler # in require section of composer.json

$ composer install # if composer.lock exists, install what is in composer.lock, otherwise install what is in composer.json

$ composer update # install and update what is in composer.json

$ composer require symfony/css-selector

$ php buscar-cursos.php

Update Composer autoload

$ composer dump-autoload # atualiza autoload

Unit tests (PHPUnit)

composer require --dev phpunit/phpunit

composer install --no-dev # to prod, download only require dependencies

$ ./vendor/bin/phpunit --version

$ ./vendor/bin/phpunit tests/TestBuscadorDeCursos.php

Verify code standards (PSR12) (PHP Code Sniffer)

https://github.com/squizlabs/PHP_CodeSniffer

$ composer require --dev squizlabs/php_codesniffer

$ vendor/bin/phpcs --version

$ vendor/bin/phpcs --standard=PSR12 src/

Syntax statical code analyzer (Phan)

https://github.com/phan/phan

$ composer require --dev phan/phan

$ vendor/bin/phan --version

$ vendor/bin/phan --allow-polyfill-parser src/Buscador.php

# depois de setar o .phan/config.php
$ vendor/bin/phan --allow-polyfill-parser 

Custom Composer scripts (add manually in composer.json)

composer test

composer cs

composer phan

# References the last 3 scripts in 1 script
composer check

# Lista all scripts available
composer list

Composer Versioning (Semantic Versioning)

https://getcomposer.org/doc/articles/versions.md#exact-version-constraint

https://semver.org/

git tag -a v1.0.0

git push origin --tags

Add a composer bin file (Cli interface)

$ vendor/bin/buscar-cursos

 git tag -a v1.1.0

 git push origin v1.1.0

al-php-composer-lib's People

Contributors

filipe1309 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.