diff --git a/.gitignore b/.gitignore index 4ba1223..859e8eb 100644 --- a/.gitignore +++ b/.gitignore @@ -386,3 +386,5 @@ FodyWeavers.xsd pullRequest.txt /vendor/ +vendor +composer.lock \ No newline at end of file diff --git a/composer.json b/composer.json index ee1071e..c125396 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ "license": "MIT", "autoload": { "psr-4": { - "Guibranco\\BancosBrasileiros\\": ["data/", "schemas/"] + "Guibranco\\BancosBrasileiros\\": ["data/", "schemas/", "src/"] } }, "authors": [ diff --git a/examples/php/Readme.md b/examples/php/Readme.md new file mode 100644 index 0000000..eb92636 --- /dev/null +++ b/examples/php/Readme.md @@ -0,0 +1,62 @@ +# Bancos Brasileiros + +Brazilian commercial banks list + + +***Para a versão em português do README.md, [siga me](/README.pt-br.md) por favor.*** + + + +# Installation + +``` +composer require guibranco/bancos-brasileiros +``` + +# Docs + +create a `index.php` + +```php +require __DIR__ . '/vendor/autoload.php'; + +use Guibranco\BancosBrasileiros\Bank; + +$banks = Bank::all(); // return collection of bank + +// show in UI +``` + + +Start a local server in the same directory. + +``` +php -S localhost:8080 +``` + + +### Available data + +Each of the Collection has the following information (schema): + +| Column | Description | Observations | +|-------------------|:---------------------------------------:|:--------------------------------------------------------------------------:| +| COMPE | Code - COMPE | 3 digits | +| ISPB | Code - ISPB | 8 digits | +| Document | Document - CNPJ | 14 numbers - 18 digits (formatted) | +| LongName | Long name | According to BACEN - STR | +| ShortName | Short name | According to BACEN - STR| +| Network | Network | RSFN, Internet, null | +| Type | Type | commercial, multiple, savings, null | +| PixType | Type of PIX/SPI participant | DRCT - Directly, INDR - Indirectly, null | +| Charge | If does charge operations | true, false, null | +| CreditDocument | If does DOC/TED operations | true, false, null | +| SalaryPortability | If does/accept salary portability | "Banco folha e Destinatário" - both operations, "Destinatário" - only receive, null | +| Products | List of products offered | In portuguese only | +| Url | Website | - | +| DateOperationStarted | Commercial operation start date | - | +| DatePixStarted | PIX operation start date | Only for those PSP of SPI | +| DateRegistered | Registration date on schema | - | +| DateUpdated | Change date on schema | - | + +--- \ No newline at end of file diff --git a/examples/php/app.css b/examples/php/app.css new file mode 100644 index 0000000..cf73c08 --- /dev/null +++ b/examples/php/app.css @@ -0,0 +1,456 @@ +@import url(https://fonts.googleapis.com/css?family=Lato:300,300italic,400,700,700italic); + +/** + * Base Elements + */ + +* { + margin: 0; + padding: 0; +} + +body, +h1, +h2, +h3, +h4, +h5, +h6, +p, +div, +span, +a, +button { + font-family: 'Lato', 'Open Sans', 'Helvetica Neue', 'Segoe UI', Helvetica, Arial, sans-serif; + line-height: 1.5; +} + +body { + background: #f3f3f3; +} + +a { + color: #016aba; + text-decoration: none; +} + +button { + font-size: 100%; +} + +p { + line-height: 1.5; + margin-bottom: 15px; +} + +/** + * Button + */ + +.button { + padding: 10px 30px 10px; + text-decoration: none; + color: #fff; + background: #016aba; + border-radius: 5px; + border: none; + font-size: 20px; + font-weight: bold; + opacity: 0.9; + display: inline-block; +} + +.button:hover { + opacity: 1; +} +/** + * Body Container + */ + +.container { + max-width: 1024px; + min-height: 100vh; + background: #f9f9f9; + margin: 0 auto; +} +/** + * Top Navigation + */ + +.menu { + height: 4em; + background-color: #677ae4; + background-color: #05526A; + background-color: #e46855; +} + +.menu h1 { + position: relative; + padding: 5px 0 0 8px; + color: #f9f9f9; + font-size: 1.8em; + font-style: italic; +} + +.menu a, +.menu .links { + display: inline-block; +} + +.menu a { + text-decoration: none; + padding: 0 15px; + color: #fff; + font-size: 20px; + font-weight: bold; +} + +.menu a:hover, +.menu a.active { + opacity: 1; +} + +.menu .links { + padding: 0 21px; +} + +.menu .links a { + position: relative; + bottom: 5px; +} + +.banks label span { + font-size: 140%; + margin: 50px auto 20px; + display: block; + text-align: center; + font-style: italic; +} + +.banks input { + padding: 11px; + font-size: 18px; + width: 500px; + margin: 20px auto 50px; + background-color: rgba(255, 255, 255, 0.75); + border: solid 1px lightgray; + display: block; +} + +.menu input:focus { + background-color: #f9f9f9; + outline: none; +} + +.menu button { + margin-right: 15px; + position: relative; + top: -1px; + left: -5px; + border-top-left-radius: 0; + border-bottom-left-radius: 0; + background-color: #262626; + cursor: pointer; + opacity: 1; +} + +.menu button:hover { + background-color: #111; + opacity: 1; +} + +.menu .results { + display: none; + position: absolute; + width: 215px; + top: 54px; + left: 10px; + background-color: #f6f6f6; + border-right: 1px solid rgba(0, 0, 0, 0.05); + border-bottom: 1px solid rgba(0, 0, 0, 0.05); +} + +.results { + margin-top: -10px; +} + +.results li { + list-style: none; + padding: 10px 15px; +} + +.menu .results li:hover { + background: #f3f3f3; +} +/** + * Content Area + */ + +.body { + padding: 15px; +} +/** + * Similar to Jumbotron + */ + +.jumbo { + padding: 50px; + background: #f6f6f6; +} + +.jumbo:hover { + background-color: #f3f3f3; +} + +.jumbo h2 { + font-size: 3.2em; + margin-top: -25px; +} + +.jumbo p, +.jumbo address { + margin-bottom: 25px; +} + +.jumbo img { + height: 200px; + position: relative; + top: -25px; + right: -20px; +} + +/** + * Individual bank Listing + */ + +.bank { + margin-top: 15px; + background-color: #f6f6f6; + padding: 20px 25px; + display: flex; + justify-content: space-between; + align-items: center; + flex-wrap: wrap; +} + +.bank:hover { + background-color: #f3f3f3; +} + +.bank img { + border-radius: 5px; +} + +.bank .image { + flex-grow: 0; + flex-basis: 150px; + margin: 20px 25px; + text-align: center; +} + +.bank button.image { + position: relative; + cursor: pointer; + border: none; + background: transparent; + z-index: 1; +} + +.bank button.image:focus { + outline: none; +} + +.bank button.image:after { + content: ""; + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + z-index: -1; + margin: -20px; + padding: 20px; + border-radius: 5px; + background: #016aba; + opacity: 0; + transition: opacity 0.25s ease-in-out; +} + +.bank button.image:focus:after, .bank button.image:hover:after { + opacity: 0.1; +} + +.bank .image img { + max-width: 100%; +} + +.bank .image.large { + margin: 30px 25px 50px 25px; + flex-basis: 100%; +} + +.bank .image small { + display: block; + margin-top: 5px; + margin-bottom: -15px; + text-align: center; + color: #016aba; + + /* This is needed to fix a safari clipping issue */ + position: relative; +} + +.bank .image.large small { + margin-top: 10px; + margin-bottom: 0px; + font-size: 110%; +} + +.bank .details { + flex-basis: 50%; + flex-grow: 2; + display: flex; + height: 150px; + margin: 20px 25px; + justify-content: space-between; + flex-wrap: wrap; + align-content: space-around; +} + +.bank h3 { + flex-basis: 100%; +} + +.bank h3 a { + display: inline; +} + +.bank .detail { + flex-basis: 50%; + font-weight: 300; + font-style: italic; + white-space: nowrap; +} + +.bank .detail span { + font-weight: 400; + font-style: normal; +} + +.bank .map { + flex-grow: 0; + flex-basis: 150px; + font-size: 0; + margin: 0px 25px; +} + +.bank .map img { + width: 150px; + height: 150px; +} + +.bank.detailed { + background: none; + align-items: flex-start; +} + +.bank.detailed .image { + flex-basis: 320px; +} + +.bank.detailed .image.large { + margin: 30px 25px 50px 25px; + flex-basis: 100%; +} + +.bank.detailed .details { + height: auto; +} + +.bank.detailed h3 { + font-size: 200%; + margin-bottom: 10px; +} + +.bank.detailed .detail { + margin: 5px 0px; + flex-basis: 100%; + flex-shrink: 2; +} + +.bank.detailed .description { + white-space: normal; + flex-basis: 100%; + flex-shrink: 1; +} + +.bank.detailed .map { + flex-basis: 100%; + margin: 50px 25px 25px 25px; +} + +.bank.detailed .map img { + width: 100%; + height: auto; +} + +@media only screen and (max-width: 919px) { + .bank.detailed .image, .bank.detailed .image.large { + margin: 30px 25px 25px 25px; + flex-basis: 100%; + cursor: default; + } + + .bank.detailed .image:hover { + flex-basis: 100%; + cursor: default; + } + + .bank.detailed .image small { + display: none; + } + + .bank.detailed button.image:hover:after { + opacity: 0; + } + + .bank.detailed button.image:focus:after { + opacity: 0.1; + } + + .bank.detailed .map { + margin-top: 25px; + } +} + +/** + * Utilities + */ + +.light { + font-weight: 300; +} + +.left { + float: left; +} + +.right { + float: right; +} + +.hidden { + display: none; +} + +.relative { + position: relative; +} + +.screen-reader{ + position: absolute; + overflow: hidden; + clip: rect(0 0 0 0); + height: 1px; width: 1px; + margin: -1px; padding: 0; border: 0; +} \ No newline at end of file diff --git a/examples/php/composer.json b/examples/php/composer.json new file mode 100644 index 0000000..9e9019f --- /dev/null +++ b/examples/php/composer.json @@ -0,0 +1,11 @@ +{ + "name": "samples/php", + "autoload": { + "psr-4": { + "Samples\\": "src/" + } + }, + "require": { + "guibranco/bancos-brasileiros": "^4.0" + } +} diff --git a/examples/php/index.php b/examples/php/index.php new file mode 100644 index 0000000..8bbd559 --- /dev/null +++ b/examples/php/index.php @@ -0,0 +1,62 @@ + + + +
+

Welcome to Bancos Brasileiros PHP example!

+

We hope you find exactly what you're looking for in a place to stay.

+
+ +
+
+ +
  • +
    +
    +

    ShortName; ?>

    +
    + Full name: LongName; ?> +
    +
    + Type: Type; ?> +
    +
    + COMPE: COMPE; ?> +
    +
    + ISPB: ISPB; ?> +
    +
    + CNPJ: Document; ?> +
    +
    + Bank bill: Charge)? $bank->Charge: "N/A"; ?> +
    +
    + TED/DOC: CreditDocument)? $bank->CreditDocument: "N/A"; ?> +
    +
    + PIX: PixType)? $bank->PixType: "N/A"; ?> +
    +
    + URL: + Url) { ?> + Url; ?> + + N/A + +
    +
    + Date updated: DateUpdated)); ?> +
    +
    +
    +
  • + +
    +
    \ No newline at end of file diff --git a/schemas/php.php b/schemas/php.php index 2b17c9d..3cde043 100644 --- a/schemas/php.php +++ b/schemas/php.php @@ -52,4 +52,4 @@ class Bank /** @var DateTime|string */ public $DateUpdated; -} +} \ No newline at end of file diff --git a/src/Bank.php b/src/Bank.php new file mode 100644 index 0000000..9267d02 --- /dev/null +++ b/src/Bank.php @@ -0,0 +1,72 @@ +