├── .gitignore ├── .travis.yml ├── LICENSE ├── Makefile ├── README.md ├── composer.json ├── composer.lock ├── docker-compose.yml ├── docker ├── Dockerfile └── nginx │ └── default.conf ├── phpunit.travis.xml.dist ├── phpunit.xml.dist ├── src ├── Annotations │ ├── Column.php │ ├── Id.php │ ├── Join.php │ ├── Persistent.php │ └── Table.php ├── DAO │ ├── GenericDAO.php │ └── IGenericDAO.php ├── Entity │ ├── EntidadeBase.php │ └── Usuario.php ├── Exception │ └── RelacionamentoException.php ├── Factory │ └── AppFactory.php └── Services │ ├── IDataBaseCreator.php │ └── PostgreSQLDataBaseCreator.php └── test ├── AppTest.php └── functional └── check-environment.phpt /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | .project 3 | .buildpath 4 | .settings 5 | !/.gitignore 6 | 7 | 8 | /vendor/ 9 | /.DS_Store 10 | 11 | .vagrant/ 12 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | services: 3 | - postgresql 4 | 5 | php: 6 | - 5.5 7 | - 5.6 8 | - 7.0 9 | 10 | script: 11 | - composer self-update 12 | - composer install 13 | - ./vendor/bin/phpunit --configuration phpunit.travis.xml.dist --coverage-clover tmp/clover.xml 14 | 15 | before_script: 16 | - psql -c 'create database pseudoorm;' -U postgres 17 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | {description} 294 | Copyright (C) {year} {fullname} 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | {signature of Ty Coon}, 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | 341 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | composer.install: 2 | docker run --rm -v ${PWD}:/app composer/composer install 3 | 4 | phpunit: 5 | docker exec -it pseudoorm ./vendor/bin/phpunit -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PseudoORM 2 | App de persistência Genérica para fins didáticos usando a interface do PDO. 3 | 4 | [![Codacy Badge](https://api.codacy.com/project/badge/Grade/7e760cb85d6a461683513671c36df91a)](https://www.codacy.com/app/eniebercunha/PseudoORM?utm_source=github.com&utm_medium=referral&utm_content=PHPMT/PseudoORM&utm_campaign=Badge_Grade) [![Build Status](https://travis-ci.org/PHPMT/PseudoORM.svg?branch=master)](https://travis-ci.org/PHPMT/PseudoORM) 5 | 6 | 7 | ## Getting started 8 | 9 | * Clone o repositorio para sua maquina 10 | * ``` git clone https://github.com/PHPMT/PseudoORM ``` 11 | * Altere as configurações do banco no arquivo `index.php` que é apenas um arquivo de exemplo. 12 | 13 | Para criar novas classes, basta criar uma entidade na pasta `model/Entity/` extendendo da classe `EntidadeBase` e criar a respectiva tabela no banco de dados (ou deixar o framework criar automaticamente), e está pronto para usar. 14 | 15 | Para modificar o comportamento padrão, basta criar um Arquivo de persistencia extendendo a classe `GenericDAO` dentro da pasta `DAO/impl` podendo sobrescrever métodos existentes e/ou adicionar novos. 16 | 17 | 18 | ## Utilizando o PseudoORM: 19 | 20 | 21 | ```php 22 | criaBancoDeDados(new PseudoORM\Services\PostgreSQLDataBaseCreator()); 29 | 30 | // Criar um usuário 31 | $usuario = $dao->create(); 32 | $usuario->setNome('Zé da Silva'); 33 | 34 | 35 | // inserir no banco de dados 36 | $dao->insert($usuario); 37 | 38 | // listar todos os objetos no banco de dados 39 | $usuarios = $dao->getList(); 40 | 41 | ``` 42 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "phpmt/pseudo-orm", 3 | "authors": [ 4 | { 5 | "name": "Jack Makiyama", 6 | "email": "jack@phpbr.org" 7 | }, 8 | { 9 | "name": "Evandro Mohr", 10 | "email": "mohr.evandro@gmail.com" 11 | }, 12 | { 13 | "name": "Enieber Cunha", 14 | "email": "eniebercunha@gmail.com" 15 | } 16 | ], 17 | "require": { 18 | "niktux/addendum": "^0.4.4", 19 | "phpunit/phpunit": "^4.8" 20 | }, 21 | "autoload": { 22 | "psr-4": { 23 | "PseudoORM\\": [ 24 | "src/", 25 | "test/" 26 | ] 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /composer.lock: -------------------------------------------------------------------------------- 1 | { 2 | "_readme": [ 3 | "This file locks the dependencies of your project to a known state", 4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", 5 | "This file is @generated automatically" 6 | ], 7 | "hash": "df252048b21d6dc92c399dc660b8e740", 8 | "packages": [ 9 | { 10 | "name": "doctrine/instantiator", 11 | "version": "1.0.5", 12 | "source": { 13 | "type": "git", 14 | "url": "https://github.com/doctrine/instantiator.git", 15 | "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" 16 | }, 17 | "dist": { 18 | "type": "zip", 19 | "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", 20 | "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", 21 | "shasum": "" 22 | }, 23 | "require": { 24 | "php": ">=5.3,<8.0-DEV" 25 | }, 26 | "require-dev": { 27 | "athletic/athletic": "~0.1.8", 28 | "ext-pdo": "*", 29 | "ext-phar": "*", 30 | "phpunit/phpunit": "~4.0", 31 | "squizlabs/php_codesniffer": "~2.0" 32 | }, 33 | "type": "library", 34 | "extra": { 35 | "branch-alias": { 36 | "dev-master": "1.0.x-dev" 37 | } 38 | }, 39 | "autoload": { 40 | "psr-4": { 41 | "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" 42 | } 43 | }, 44 | "notification-url": "https://packagist.org/downloads/", 45 | "license": [ 46 | "MIT" 47 | ], 48 | "authors": [ 49 | { 50 | "name": "Marco Pivetta", 51 | "email": "ocramius@gmail.com", 52 | "homepage": "http://ocramius.github.com/" 53 | } 54 | ], 55 | "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", 56 | "homepage": "https://github.com/doctrine/instantiator", 57 | "keywords": [ 58 | "constructor", 59 | "instantiate" 60 | ], 61 | "time": "2015-06-14 21:17:01" 62 | }, 63 | { 64 | "name": "niktux/addendum", 65 | "version": "v0.4.4", 66 | "source": { 67 | "type": "git", 68 | "url": "https://github.com/Niktux/addendum.git", 69 | "reference": "ec970cf3d59e25a7ac578505d20f223028f0317a" 70 | }, 71 | "dist": { 72 | "type": "zip", 73 | "url": "https://api.github.com/repos/Niktux/addendum/zipball/ec970cf3d59e25a7ac578505d20f223028f0317a", 74 | "reference": "ec970cf3d59e25a7ac578505d20f223028f0317a", 75 | "shasum": "" 76 | }, 77 | "require-dev": { 78 | "phpunit/phpunit": "~3.7" 79 | }, 80 | "type": "library", 81 | "autoload": { 82 | "psr-0": { 83 | "Addendum": "lib/", 84 | "Tests\\Addendum": "" 85 | } 86 | }, 87 | "notification-url": "https://packagist.org/downloads/", 88 | "authors": [ 89 | { 90 | "name": "Nicolas Le Nardou", 91 | "email": "nico.ln@gmail.com", 92 | "homepage": "https://github.com/Niktux" 93 | }, 94 | { 95 | "name": "Johno Suchal", 96 | "email": "jan.suchal@gmail.com" 97 | } 98 | ], 99 | "description": "Annotations support for PHP (fork of addendum)", 100 | "keywords": [ 101 | "annotations", 102 | "docblock", 103 | "metadata", 104 | "parser" 105 | ], 106 | "abandoned": true, 107 | "time": "2013-07-17 08:37:59" 108 | }, 109 | { 110 | "name": "phpdocumentor/reflection-docblock", 111 | "version": "2.0.4", 112 | "source": { 113 | "type": "git", 114 | "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", 115 | "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8" 116 | }, 117 | "dist": { 118 | "type": "zip", 119 | "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d68dbdc53dc358a816f00b300704702b2eaff7b8", 120 | "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8", 121 | "shasum": "" 122 | }, 123 | "require": { 124 | "php": ">=5.3.3" 125 | }, 126 | "require-dev": { 127 | "phpunit/phpunit": "~4.0" 128 | }, 129 | "suggest": { 130 | "dflydev/markdown": "~1.0", 131 | "erusev/parsedown": "~1.0" 132 | }, 133 | "type": "library", 134 | "extra": { 135 | "branch-alias": { 136 | "dev-master": "2.0.x-dev" 137 | } 138 | }, 139 | "autoload": { 140 | "psr-0": { 141 | "phpDocumentor": [ 142 | "src/" 143 | ] 144 | } 145 | }, 146 | "notification-url": "https://packagist.org/downloads/", 147 | "license": [ 148 | "MIT" 149 | ], 150 | "authors": [ 151 | { 152 | "name": "Mike van Riel", 153 | "email": "mike.vanriel@naenius.com" 154 | } 155 | ], 156 | "time": "2015-02-03 12:10:50" 157 | }, 158 | { 159 | "name": "phpspec/prophecy", 160 | "version": "v1.5.0", 161 | "source": { 162 | "type": "git", 163 | "url": "https://github.com/phpspec/prophecy.git", 164 | "reference": "4745ded9307786b730d7a60df5cb5a6c43cf95f7" 165 | }, 166 | "dist": { 167 | "type": "zip", 168 | "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4745ded9307786b730d7a60df5cb5a6c43cf95f7", 169 | "reference": "4745ded9307786b730d7a60df5cb5a6c43cf95f7", 170 | "shasum": "" 171 | }, 172 | "require": { 173 | "doctrine/instantiator": "^1.0.2", 174 | "phpdocumentor/reflection-docblock": "~2.0", 175 | "sebastian/comparator": "~1.1" 176 | }, 177 | "require-dev": { 178 | "phpspec/phpspec": "~2.0" 179 | }, 180 | "type": "library", 181 | "extra": { 182 | "branch-alias": { 183 | "dev-master": "1.4.x-dev" 184 | } 185 | }, 186 | "autoload": { 187 | "psr-0": { 188 | "Prophecy\\": "src/" 189 | } 190 | }, 191 | "notification-url": "https://packagist.org/downloads/", 192 | "license": [ 193 | "MIT" 194 | ], 195 | "authors": [ 196 | { 197 | "name": "Konstantin Kudryashov", 198 | "email": "ever.zet@gmail.com", 199 | "homepage": "http://everzet.com" 200 | }, 201 | { 202 | "name": "Marcello Duarte", 203 | "email": "marcello.duarte@gmail.com" 204 | } 205 | ], 206 | "description": "Highly opinionated mocking framework for PHP 5.3+", 207 | "homepage": "https://github.com/phpspec/prophecy", 208 | "keywords": [ 209 | "Double", 210 | "Dummy", 211 | "fake", 212 | "mock", 213 | "spy", 214 | "stub" 215 | ], 216 | "time": "2015-08-13 10:07:40" 217 | }, 218 | { 219 | "name": "phpunit/php-code-coverage", 220 | "version": "2.2.2", 221 | "source": { 222 | "type": "git", 223 | "url": "https://github.com/sebastianbergmann/php-code-coverage.git", 224 | "reference": "2d7c03c0e4e080901b8f33b2897b0577be18a13c" 225 | }, 226 | "dist": { 227 | "type": "zip", 228 | "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2d7c03c0e4e080901b8f33b2897b0577be18a13c", 229 | "reference": "2d7c03c0e4e080901b8f33b2897b0577be18a13c", 230 | "shasum": "" 231 | }, 232 | "require": { 233 | "php": ">=5.3.3", 234 | "phpunit/php-file-iterator": "~1.3", 235 | "phpunit/php-text-template": "~1.2", 236 | "phpunit/php-token-stream": "~1.3", 237 | "sebastian/environment": "^1.3.2", 238 | "sebastian/version": "~1.0" 239 | }, 240 | "require-dev": { 241 | "ext-xdebug": ">=2.1.4", 242 | "phpunit/phpunit": "~4" 243 | }, 244 | "suggest": { 245 | "ext-dom": "*", 246 | "ext-xdebug": ">=2.2.1", 247 | "ext-xmlwriter": "*" 248 | }, 249 | "type": "library", 250 | "extra": { 251 | "branch-alias": { 252 | "dev-master": "2.2.x-dev" 253 | } 254 | }, 255 | "autoload": { 256 | "classmap": [ 257 | "src/" 258 | ] 259 | }, 260 | "notification-url": "https://packagist.org/downloads/", 261 | "license": [ 262 | "BSD-3-Clause" 263 | ], 264 | "authors": [ 265 | { 266 | "name": "Sebastian Bergmann", 267 | "email": "sb@sebastian-bergmann.de", 268 | "role": "lead" 269 | } 270 | ], 271 | "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", 272 | "homepage": "https://github.com/sebastianbergmann/php-code-coverage", 273 | "keywords": [ 274 | "coverage", 275 | "testing", 276 | "xunit" 277 | ], 278 | "time": "2015-08-04 03:42:39" 279 | }, 280 | { 281 | "name": "phpunit/php-file-iterator", 282 | "version": "1.4.1", 283 | "source": { 284 | "type": "git", 285 | "url": "https://github.com/sebastianbergmann/php-file-iterator.git", 286 | "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0" 287 | }, 288 | "dist": { 289 | "type": "zip", 290 | "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/6150bf2c35d3fc379e50c7602b75caceaa39dbf0", 291 | "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0", 292 | "shasum": "" 293 | }, 294 | "require": { 295 | "php": ">=5.3.3" 296 | }, 297 | "type": "library", 298 | "extra": { 299 | "branch-alias": { 300 | "dev-master": "1.4.x-dev" 301 | } 302 | }, 303 | "autoload": { 304 | "classmap": [ 305 | "src/" 306 | ] 307 | }, 308 | "notification-url": "https://packagist.org/downloads/", 309 | "license": [ 310 | "BSD-3-Clause" 311 | ], 312 | "authors": [ 313 | { 314 | "name": "Sebastian Bergmann", 315 | "email": "sb@sebastian-bergmann.de", 316 | "role": "lead" 317 | } 318 | ], 319 | "description": "FilterIterator implementation that filters files based on a list of suffixes.", 320 | "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", 321 | "keywords": [ 322 | "filesystem", 323 | "iterator" 324 | ], 325 | "time": "2015-06-21 13:08:43" 326 | }, 327 | { 328 | "name": "phpunit/php-text-template", 329 | "version": "1.2.1", 330 | "source": { 331 | "type": "git", 332 | "url": "https://github.com/sebastianbergmann/php-text-template.git", 333 | "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" 334 | }, 335 | "dist": { 336 | "type": "zip", 337 | "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", 338 | "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", 339 | "shasum": "" 340 | }, 341 | "require": { 342 | "php": ">=5.3.3" 343 | }, 344 | "type": "library", 345 | "autoload": { 346 | "classmap": [ 347 | "src/" 348 | ] 349 | }, 350 | "notification-url": "https://packagist.org/downloads/", 351 | "license": [ 352 | "BSD-3-Clause" 353 | ], 354 | "authors": [ 355 | { 356 | "name": "Sebastian Bergmann", 357 | "email": "sebastian@phpunit.de", 358 | "role": "lead" 359 | } 360 | ], 361 | "description": "Simple template engine.", 362 | "homepage": "https://github.com/sebastianbergmann/php-text-template/", 363 | "keywords": [ 364 | "template" 365 | ], 366 | "time": "2015-06-21 13:50:34" 367 | }, 368 | { 369 | "name": "phpunit/php-timer", 370 | "version": "1.0.7", 371 | "source": { 372 | "type": "git", 373 | "url": "https://github.com/sebastianbergmann/php-timer.git", 374 | "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b" 375 | }, 376 | "dist": { 377 | "type": "zip", 378 | "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3e82f4e9fc92665fafd9157568e4dcb01d014e5b", 379 | "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b", 380 | "shasum": "" 381 | }, 382 | "require": { 383 | "php": ">=5.3.3" 384 | }, 385 | "type": "library", 386 | "autoload": { 387 | "classmap": [ 388 | "src/" 389 | ] 390 | }, 391 | "notification-url": "https://packagist.org/downloads/", 392 | "license": [ 393 | "BSD-3-Clause" 394 | ], 395 | "authors": [ 396 | { 397 | "name": "Sebastian Bergmann", 398 | "email": "sb@sebastian-bergmann.de", 399 | "role": "lead" 400 | } 401 | ], 402 | "description": "Utility class for timing", 403 | "homepage": "https://github.com/sebastianbergmann/php-timer/", 404 | "keywords": [ 405 | "timer" 406 | ], 407 | "time": "2015-06-21 08:01:12" 408 | }, 409 | { 410 | "name": "phpunit/php-token-stream", 411 | "version": "1.4.6", 412 | "source": { 413 | "type": "git", 414 | "url": "https://github.com/sebastianbergmann/php-token-stream.git", 415 | "reference": "3ab72c62e550370a6cd5dc873e1a04ab57562f5b" 416 | }, 417 | "dist": { 418 | "type": "zip", 419 | "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3ab72c62e550370a6cd5dc873e1a04ab57562f5b", 420 | "reference": "3ab72c62e550370a6cd5dc873e1a04ab57562f5b", 421 | "shasum": "" 422 | }, 423 | "require": { 424 | "ext-tokenizer": "*", 425 | "php": ">=5.3.3" 426 | }, 427 | "require-dev": { 428 | "phpunit/phpunit": "~4.2" 429 | }, 430 | "type": "library", 431 | "extra": { 432 | "branch-alias": { 433 | "dev-master": "1.4-dev" 434 | } 435 | }, 436 | "autoload": { 437 | "classmap": [ 438 | "src/" 439 | ] 440 | }, 441 | "notification-url": "https://packagist.org/downloads/", 442 | "license": [ 443 | "BSD-3-Clause" 444 | ], 445 | "authors": [ 446 | { 447 | "name": "Sebastian Bergmann", 448 | "email": "sebastian@phpunit.de" 449 | } 450 | ], 451 | "description": "Wrapper around PHP's tokenizer extension.", 452 | "homepage": "https://github.com/sebastianbergmann/php-token-stream/", 453 | "keywords": [ 454 | "tokenizer" 455 | ], 456 | "time": "2015-08-16 08:51:00" 457 | }, 458 | { 459 | "name": "phpunit/phpunit", 460 | "version": "4.8.6", 461 | "source": { 462 | "type": "git", 463 | "url": "https://github.com/sebastianbergmann/phpunit.git", 464 | "reference": "2246830f4a1a551c67933e4171bf2126dc29d357" 465 | }, 466 | "dist": { 467 | "type": "zip", 468 | "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/2246830f4a1a551c67933e4171bf2126dc29d357", 469 | "reference": "2246830f4a1a551c67933e4171bf2126dc29d357", 470 | "shasum": "" 471 | }, 472 | "require": { 473 | "ext-dom": "*", 474 | "ext-json": "*", 475 | "ext-pcre": "*", 476 | "ext-reflection": "*", 477 | "ext-spl": "*", 478 | "php": ">=5.3.3", 479 | "phpspec/prophecy": "^1.3.1", 480 | "phpunit/php-code-coverage": "~2.1", 481 | "phpunit/php-file-iterator": "~1.4", 482 | "phpunit/php-text-template": "~1.2", 483 | "phpunit/php-timer": ">=1.0.6", 484 | "phpunit/phpunit-mock-objects": "~2.3", 485 | "sebastian/comparator": "~1.1", 486 | "sebastian/diff": "~1.2", 487 | "sebastian/environment": "~1.3", 488 | "sebastian/exporter": "~1.2", 489 | "sebastian/global-state": "~1.0", 490 | "sebastian/version": "~1.0", 491 | "symfony/yaml": "~2.1|~3.0" 492 | }, 493 | "suggest": { 494 | "phpunit/php-invoker": "~1.1" 495 | }, 496 | "bin": [ 497 | "phpunit" 498 | ], 499 | "type": "library", 500 | "extra": { 501 | "branch-alias": { 502 | "dev-master": "4.8.x-dev" 503 | } 504 | }, 505 | "autoload": { 506 | "classmap": [ 507 | "src/" 508 | ] 509 | }, 510 | "notification-url": "https://packagist.org/downloads/", 511 | "license": [ 512 | "BSD-3-Clause" 513 | ], 514 | "authors": [ 515 | { 516 | "name": "Sebastian Bergmann", 517 | "email": "sebastian@phpunit.de", 518 | "role": "lead" 519 | } 520 | ], 521 | "description": "The PHP Unit Testing framework.", 522 | "homepage": "https://phpunit.de/", 523 | "keywords": [ 524 | "phpunit", 525 | "testing", 526 | "xunit" 527 | ], 528 | "time": "2015-08-24 04:09:38" 529 | }, 530 | { 531 | "name": "phpunit/phpunit-mock-objects", 532 | "version": "2.3.7", 533 | "source": { 534 | "type": "git", 535 | "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", 536 | "reference": "5e2645ad49d196e020b85598d7c97e482725786a" 537 | }, 538 | "dist": { 539 | "type": "zip", 540 | "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/5e2645ad49d196e020b85598d7c97e482725786a", 541 | "reference": "5e2645ad49d196e020b85598d7c97e482725786a", 542 | "shasum": "" 543 | }, 544 | "require": { 545 | "doctrine/instantiator": "^1.0.2", 546 | "php": ">=5.3.3", 547 | "phpunit/php-text-template": "~1.2", 548 | "sebastian/exporter": "~1.2" 549 | }, 550 | "require-dev": { 551 | "phpunit/phpunit": "~4.4" 552 | }, 553 | "suggest": { 554 | "ext-soap": "*" 555 | }, 556 | "type": "library", 557 | "extra": { 558 | "branch-alias": { 559 | "dev-master": "2.3.x-dev" 560 | } 561 | }, 562 | "autoload": { 563 | "classmap": [ 564 | "src/" 565 | ] 566 | }, 567 | "notification-url": "https://packagist.org/downloads/", 568 | "license": [ 569 | "BSD-3-Clause" 570 | ], 571 | "authors": [ 572 | { 573 | "name": "Sebastian Bergmann", 574 | "email": "sb@sebastian-bergmann.de", 575 | "role": "lead" 576 | } 577 | ], 578 | "description": "Mock Object library for PHPUnit", 579 | "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", 580 | "keywords": [ 581 | "mock", 582 | "xunit" 583 | ], 584 | "time": "2015-08-19 09:14:08" 585 | }, 586 | { 587 | "name": "sebastian/comparator", 588 | "version": "1.2.0", 589 | "source": { 590 | "type": "git", 591 | "url": "https://github.com/sebastianbergmann/comparator.git", 592 | "reference": "937efb279bd37a375bcadf584dec0726f84dbf22" 593 | }, 594 | "dist": { 595 | "type": "zip", 596 | "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/937efb279bd37a375bcadf584dec0726f84dbf22", 597 | "reference": "937efb279bd37a375bcadf584dec0726f84dbf22", 598 | "shasum": "" 599 | }, 600 | "require": { 601 | "php": ">=5.3.3", 602 | "sebastian/diff": "~1.2", 603 | "sebastian/exporter": "~1.2" 604 | }, 605 | "require-dev": { 606 | "phpunit/phpunit": "~4.4" 607 | }, 608 | "type": "library", 609 | "extra": { 610 | "branch-alias": { 611 | "dev-master": "1.2.x-dev" 612 | } 613 | }, 614 | "autoload": { 615 | "classmap": [ 616 | "src/" 617 | ] 618 | }, 619 | "notification-url": "https://packagist.org/downloads/", 620 | "license": [ 621 | "BSD-3-Clause" 622 | ], 623 | "authors": [ 624 | { 625 | "name": "Jeff Welch", 626 | "email": "whatthejeff@gmail.com" 627 | }, 628 | { 629 | "name": "Volker Dusch", 630 | "email": "github@wallbash.com" 631 | }, 632 | { 633 | "name": "Bernhard Schussek", 634 | "email": "bschussek@2bepublished.at" 635 | }, 636 | { 637 | "name": "Sebastian Bergmann", 638 | "email": "sebastian@phpunit.de" 639 | } 640 | ], 641 | "description": "Provides the functionality to compare PHP values for equality", 642 | "homepage": "http://www.github.com/sebastianbergmann/comparator", 643 | "keywords": [ 644 | "comparator", 645 | "compare", 646 | "equality" 647 | ], 648 | "time": "2015-07-26 15:48:44" 649 | }, 650 | { 651 | "name": "sebastian/diff", 652 | "version": "1.3.0", 653 | "source": { 654 | "type": "git", 655 | "url": "https://github.com/sebastianbergmann/diff.git", 656 | "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3" 657 | }, 658 | "dist": { 659 | "type": "zip", 660 | "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/863df9687835c62aa423a22412d26fa2ebde3fd3", 661 | "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3", 662 | "shasum": "" 663 | }, 664 | "require": { 665 | "php": ">=5.3.3" 666 | }, 667 | "require-dev": { 668 | "phpunit/phpunit": "~4.2" 669 | }, 670 | "type": "library", 671 | "extra": { 672 | "branch-alias": { 673 | "dev-master": "1.3-dev" 674 | } 675 | }, 676 | "autoload": { 677 | "classmap": [ 678 | "src/" 679 | ] 680 | }, 681 | "notification-url": "https://packagist.org/downloads/", 682 | "license": [ 683 | "BSD-3-Clause" 684 | ], 685 | "authors": [ 686 | { 687 | "name": "Kore Nordmann", 688 | "email": "mail@kore-nordmann.de" 689 | }, 690 | { 691 | "name": "Sebastian Bergmann", 692 | "email": "sebastian@phpunit.de" 693 | } 694 | ], 695 | "description": "Diff implementation", 696 | "homepage": "http://www.github.com/sebastianbergmann/diff", 697 | "keywords": [ 698 | "diff" 699 | ], 700 | "time": "2015-02-22 15:13:53" 701 | }, 702 | { 703 | "name": "sebastian/environment", 704 | "version": "1.3.2", 705 | "source": { 706 | "type": "git", 707 | "url": "https://github.com/sebastianbergmann/environment.git", 708 | "reference": "6324c907ce7a52478eeeaede764f48733ef5ae44" 709 | }, 710 | "dist": { 711 | "type": "zip", 712 | "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6324c907ce7a52478eeeaede764f48733ef5ae44", 713 | "reference": "6324c907ce7a52478eeeaede764f48733ef5ae44", 714 | "shasum": "" 715 | }, 716 | "require": { 717 | "php": ">=5.3.3" 718 | }, 719 | "require-dev": { 720 | "phpunit/phpunit": "~4.4" 721 | }, 722 | "type": "library", 723 | "extra": { 724 | "branch-alias": { 725 | "dev-master": "1.3.x-dev" 726 | } 727 | }, 728 | "autoload": { 729 | "classmap": [ 730 | "src/" 731 | ] 732 | }, 733 | "notification-url": "https://packagist.org/downloads/", 734 | "license": [ 735 | "BSD-3-Clause" 736 | ], 737 | "authors": [ 738 | { 739 | "name": "Sebastian Bergmann", 740 | "email": "sebastian@phpunit.de" 741 | } 742 | ], 743 | "description": "Provides functionality to handle HHVM/PHP environments", 744 | "homepage": "http://www.github.com/sebastianbergmann/environment", 745 | "keywords": [ 746 | "Xdebug", 747 | "environment", 748 | "hhvm" 749 | ], 750 | "time": "2015-08-03 06:14:51" 751 | }, 752 | { 753 | "name": "sebastian/exporter", 754 | "version": "1.2.1", 755 | "source": { 756 | "type": "git", 757 | "url": "https://github.com/sebastianbergmann/exporter.git", 758 | "reference": "7ae5513327cb536431847bcc0c10edba2701064e" 759 | }, 760 | "dist": { 761 | "type": "zip", 762 | "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/7ae5513327cb536431847bcc0c10edba2701064e", 763 | "reference": "7ae5513327cb536431847bcc0c10edba2701064e", 764 | "shasum": "" 765 | }, 766 | "require": { 767 | "php": ">=5.3.3", 768 | "sebastian/recursion-context": "~1.0" 769 | }, 770 | "require-dev": { 771 | "phpunit/phpunit": "~4.4" 772 | }, 773 | "type": "library", 774 | "extra": { 775 | "branch-alias": { 776 | "dev-master": "1.2.x-dev" 777 | } 778 | }, 779 | "autoload": { 780 | "classmap": [ 781 | "src/" 782 | ] 783 | }, 784 | "notification-url": "https://packagist.org/downloads/", 785 | "license": [ 786 | "BSD-3-Clause" 787 | ], 788 | "authors": [ 789 | { 790 | "name": "Jeff Welch", 791 | "email": "whatthejeff@gmail.com" 792 | }, 793 | { 794 | "name": "Volker Dusch", 795 | "email": "github@wallbash.com" 796 | }, 797 | { 798 | "name": "Bernhard Schussek", 799 | "email": "bschussek@2bepublished.at" 800 | }, 801 | { 802 | "name": "Sebastian Bergmann", 803 | "email": "sebastian@phpunit.de" 804 | }, 805 | { 806 | "name": "Adam Harvey", 807 | "email": "aharvey@php.net" 808 | } 809 | ], 810 | "description": "Provides the functionality to export PHP variables for visualization", 811 | "homepage": "http://www.github.com/sebastianbergmann/exporter", 812 | "keywords": [ 813 | "export", 814 | "exporter" 815 | ], 816 | "time": "2015-06-21 07:55:53" 817 | }, 818 | { 819 | "name": "sebastian/global-state", 820 | "version": "1.0.0", 821 | "source": { 822 | "type": "git", 823 | "url": "https://github.com/sebastianbergmann/global-state.git", 824 | "reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01" 825 | }, 826 | "dist": { 827 | "type": "zip", 828 | "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/c7428acdb62ece0a45e6306f1ae85e1c05b09c01", 829 | "reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01", 830 | "shasum": "" 831 | }, 832 | "require": { 833 | "php": ">=5.3.3" 834 | }, 835 | "require-dev": { 836 | "phpunit/phpunit": "~4.2" 837 | }, 838 | "suggest": { 839 | "ext-uopz": "*" 840 | }, 841 | "type": "library", 842 | "extra": { 843 | "branch-alias": { 844 | "dev-master": "1.0-dev" 845 | } 846 | }, 847 | "autoload": { 848 | "classmap": [ 849 | "src/" 850 | ] 851 | }, 852 | "notification-url": "https://packagist.org/downloads/", 853 | "license": [ 854 | "BSD-3-Clause" 855 | ], 856 | "authors": [ 857 | { 858 | "name": "Sebastian Bergmann", 859 | "email": "sebastian@phpunit.de" 860 | } 861 | ], 862 | "description": "Snapshotting of global state", 863 | "homepage": "http://www.github.com/sebastianbergmann/global-state", 864 | "keywords": [ 865 | "global state" 866 | ], 867 | "time": "2014-10-06 09:23:50" 868 | }, 869 | { 870 | "name": "sebastian/recursion-context", 871 | "version": "1.0.1", 872 | "source": { 873 | "type": "git", 874 | "url": "https://github.com/sebastianbergmann/recursion-context.git", 875 | "reference": "994d4a811bafe801fb06dccbee797863ba2792ba" 876 | }, 877 | "dist": { 878 | "type": "zip", 879 | "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/994d4a811bafe801fb06dccbee797863ba2792ba", 880 | "reference": "994d4a811bafe801fb06dccbee797863ba2792ba", 881 | "shasum": "" 882 | }, 883 | "require": { 884 | "php": ">=5.3.3" 885 | }, 886 | "require-dev": { 887 | "phpunit/phpunit": "~4.4" 888 | }, 889 | "type": "library", 890 | "extra": { 891 | "branch-alias": { 892 | "dev-master": "1.0.x-dev" 893 | } 894 | }, 895 | "autoload": { 896 | "classmap": [ 897 | "src/" 898 | ] 899 | }, 900 | "notification-url": "https://packagist.org/downloads/", 901 | "license": [ 902 | "BSD-3-Clause" 903 | ], 904 | "authors": [ 905 | { 906 | "name": "Jeff Welch", 907 | "email": "whatthejeff@gmail.com" 908 | }, 909 | { 910 | "name": "Sebastian Bergmann", 911 | "email": "sebastian@phpunit.de" 912 | }, 913 | { 914 | "name": "Adam Harvey", 915 | "email": "aharvey@php.net" 916 | } 917 | ], 918 | "description": "Provides functionality to recursively process PHP variables", 919 | "homepage": "http://www.github.com/sebastianbergmann/recursion-context", 920 | "time": "2015-06-21 08:04:50" 921 | }, 922 | { 923 | "name": "sebastian/version", 924 | "version": "1.0.6", 925 | "source": { 926 | "type": "git", 927 | "url": "https://github.com/sebastianbergmann/version.git", 928 | "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" 929 | }, 930 | "dist": { 931 | "type": "zip", 932 | "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", 933 | "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", 934 | "shasum": "" 935 | }, 936 | "type": "library", 937 | "autoload": { 938 | "classmap": [ 939 | "src/" 940 | ] 941 | }, 942 | "notification-url": "https://packagist.org/downloads/", 943 | "license": [ 944 | "BSD-3-Clause" 945 | ], 946 | "authors": [ 947 | { 948 | "name": "Sebastian Bergmann", 949 | "email": "sebastian@phpunit.de", 950 | "role": "lead" 951 | } 952 | ], 953 | "description": "Library that helps with managing the version number of Git-hosted PHP projects", 954 | "homepage": "https://github.com/sebastianbergmann/version", 955 | "time": "2015-06-21 13:59:46" 956 | }, 957 | { 958 | "name": "symfony/yaml", 959 | "version": "v2.7.3", 960 | "source": { 961 | "type": "git", 962 | "url": "https://github.com/symfony/Yaml.git", 963 | "reference": "71340e996171474a53f3d29111d046be4ad8a0ff" 964 | }, 965 | "dist": { 966 | "type": "zip", 967 | "url": "https://api.github.com/repos/symfony/Yaml/zipball/71340e996171474a53f3d29111d046be4ad8a0ff", 968 | "reference": "71340e996171474a53f3d29111d046be4ad8a0ff", 969 | "shasum": "" 970 | }, 971 | "require": { 972 | "php": ">=5.3.9" 973 | }, 974 | "require-dev": { 975 | "symfony/phpunit-bridge": "~2.7" 976 | }, 977 | "type": "library", 978 | "extra": { 979 | "branch-alias": { 980 | "dev-master": "2.7-dev" 981 | } 982 | }, 983 | "autoload": { 984 | "psr-4": { 985 | "Symfony\\Component\\Yaml\\": "" 986 | } 987 | }, 988 | "notification-url": "https://packagist.org/downloads/", 989 | "license": [ 990 | "MIT" 991 | ], 992 | "authors": [ 993 | { 994 | "name": "Fabien Potencier", 995 | "email": "fabien@symfony.com" 996 | }, 997 | { 998 | "name": "Symfony Community", 999 | "homepage": "https://symfony.com/contributors" 1000 | } 1001 | ], 1002 | "description": "Symfony Yaml Component", 1003 | "homepage": "https://symfony.com", 1004 | "time": "2015-07-28 14:07:07" 1005 | } 1006 | ], 1007 | "packages-dev": [], 1008 | "aliases": [], 1009 | "minimum-stability": "stable", 1010 | "stability-flags": [], 1011 | "prefer-stable": false, 1012 | "prefer-lowest": false, 1013 | "platform": [], 1014 | "platform-dev": [] 1015 | } 1016 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | 3 | volumes: 4 | postgres-data: 5 | driver: local 6 | 7 | services: 8 | web: 9 | image: nginx:latest 10 | ports: 11 | - "8084:80" 12 | volumes: 13 | - .:/src 14 | - ./docker/nginx:/etc/nginx/conf.d 15 | links: 16 | - php 17 | php: 18 | container_name: pseudoorm 19 | build: ./docker/ 20 | links: 21 | - postgres 22 | volumes_from: 23 | - app 24 | app: 25 | image: php:7-fpm 26 | volumes: 27 | - .:/src 28 | command: "true" 29 | postgres: 30 | image: postgres:9.6 31 | container_name: postgres 32 | volumes: 33 | - postgres-data:/var/lib/postgresql/data 34 | ports: 35 | - "5444:5432" 36 | environment: 37 | - POSTGRES_PASSWORD=root 38 | - POSTGRES_DB=pseudoorm 39 | - POSTGRES_USER=root 40 | -------------------------------------------------------------------------------- /docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:7-fpm 2 | 3 | RUN buildDeps="libpq-dev libzip-dev libicu-dev" && \ 4 | apt-get update && \ 5 | apt-get install -y $buildDeps --no-install-recommends && \ 6 | rm -rf /var/lib/apt/lists/* && \ 7 | docker-php-ext-install \ 8 | pdo \ 9 | pdo_pgsql \ 10 | mbstring \ 11 | intl 12 | 13 | WORKDIR /src 14 | -------------------------------------------------------------------------------- /docker/nginx/default.conf: -------------------------------------------------------------------------------- 1 | server { 2 | index index.php index.html; 3 | server_name pseudoorm.local; 4 | error_log /var/log/nginx/error.log; 5 | access_log /var/log/nginx/access.log; 6 | root /src; 7 | 8 | location ~ \.php$ { 9 | try_files $uri =404; 10 | fastcgi_split_path_info ^(.+\.php)(/.+)$; 11 | fastcgi_pass php:9000; 12 | fastcgi_index index.php; 13 | include fastcgi_params; 14 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 15 | fastcgi_param PATH_INFO $fastcgi_path_info; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /phpunit.travis.xml.dist: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | test 11 | 12 | 13 | test/functional 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /phpunit.xml.dist: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | test 11 | 12 | 13 | test/functional 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/Annotations/Column.php: -------------------------------------------------------------------------------- 1 | type = $classe->getName(); 21 | $this->setTableName(); 22 | } 23 | 24 | private function setTableName() 25 | { 26 | $classe = new ReflectionAnnotatedClass($this->type); 27 | if ($classe->hasAnnotation('Table') && $classe->getAnnotation('Table') != '') { 28 | $this->tableName = strtolower($classe->getAnnotation('Table')->value); 29 | return; 30 | } 31 | $this->tableName = strtolower($classe->getShortName()); 32 | } 33 | 34 | public function create() 35 | { 36 | return new $this->type(); 37 | } 38 | 39 | /** 40 | * {@inheritDoc} 41 | */ 42 | public function getById($uid) 43 | { 44 | $connection = new PDO( 45 | DB_DSN, 46 | DB_USERNAME, 47 | DB_PASSWORD, 48 | array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION ) 49 | ); 50 | $sql = " SELECT * FROM " . SCHEMA . strtolower($this->type) ." where uid = :uid"; 51 | $stmt = $connection->prepare($sql); 52 | $stmt->bindValue(":uid", $uid, PDO::PARAM_INT); 53 | $stmt->setFetchMode(PDO::FETCH_CLASS, $this->type); 54 | $stmt->execute(); 55 | $object = $stmt->fetch(); 56 | $connection = null; 57 | return $object; 58 | } 59 | 60 | /** 61 | * {@inheritDoc} 62 | */ 63 | public function getList($sortColumn = null, $sortOrder = 'ASC', $limit = 1000000, $offset = 0) 64 | { 65 | $connection = new PDO( 66 | DB_DSN, 67 | DB_USERNAME, 68 | DB_PASSWORD, 69 | array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION ) 70 | ); 71 | $sql = " SELECT * FROM " . SCHEMA . $this->tableName . 72 | ($sortColumn != null ? " ORDER BY $sortColumn $sortOrder " : '') . 73 | " LIMIT :limit OFFSET :offset; "; 74 | $stmt = $connection->prepare($sql); 75 | $stmt->bindValue(":limit", $limit, PDO::PARAM_INT); 76 | $stmt->bindValue(":offset", $offset, PDO::PARAM_INT); 77 | $stmt->setFetchMode(PDO::FETCH_CLASS, $this->type); 78 | $stmt->execute(); 79 | $list = $stmt->fetchAll(); 80 | $connection = null; 81 | return $list; 82 | } 83 | 84 | /** 85 | * {@inheritDoc} 86 | */ 87 | public function insert(EntidadeBase $object) 88 | { 89 | $connection = new PDO( 90 | DB_DSN, 91 | DB_USERNAME, 92 | DB_PASSWORD, 93 | array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION ) 94 | ); 95 | //TODO extract to a method. Too much responsability 96 | $obj = new \ReflectionObject($object); 97 | $parametros = array(); 98 | $attributos = array(); 99 | foreach ($obj->getProperties() as $property) { 100 | $property->setAccessible(true); 101 | if ($property->name != 'uid' && ($property->getValue($object) != '')) { 102 | $attributos[$property->name] = $property->getValue($object); 103 | $parametros[] = ":".$property->name; 104 | } 105 | } 106 | 107 | $queryParams = "(".implode(", ", array_keys($attributos)).") VALUES(". implode(', ', $parametros) ." )"; 108 | try { 109 | $sql = " INSERT INTO " . SCHEMA . $this->tableName . " $queryParams RETURNING uid;"; 110 | $stmt = $connection->prepare($sql); 111 | $this->bindArrayValue($stmt, $attributos); 112 | $stmt->execute(); 113 | $result = $stmt->fetch(PDO::FETCH_ASSOC); 114 | $uid = $result['uid']; 115 | $connection = null; 116 | } catch (Exception $e) { 117 | $message = "Existem relacionamentos vinculados à esse objeto. Impossível excluir."; 118 | throw new RelacionamentoException($message); 119 | $connection = null; 120 | } 121 | return $uid; 122 | } 123 | 124 | 125 | /** 126 | * {@inheritDoc} 127 | */ 128 | public function update(EntidadeBase $object) 129 | { 130 | $connection = new PDO( 131 | DB_DSN, 132 | DB_USERNAME, 133 | DB_PASSWORD, 134 | array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION ) 135 | ); 136 | //TODO extract to a method. Too much responsability 137 | $obj = new \ReflectionObject($object); 138 | $parametros = array(); 139 | $attributos = array(); 140 | foreach ($obj->getProperties() as $property) { 141 | $property->setAccessible(true); 142 | if ($property->name != 'uid' && ($property->getValue($object) != '')) { 143 | $attributos[] = $property->name; 144 | $parametros[] = ":".$property->name; 145 | } 146 | } 147 | 148 | $queryParams = implode(', ', $parametros); 149 | 150 | try { 151 | $sql = "UPDATE " . SCHEMA . $this->tableName . " SET " . $queryParams . ' WHERE uid = :uid;'; 152 | $stmt = $connection->prepare($sql); 153 | $stmt->bindValue(":uid", $object->uid, PDO::PARAM_INT); 154 | $this->bindArrayValue($stmt, $attributos); 155 | $stmt->execute(); 156 | $connection = null; 157 | } catch (Exception $e) { 158 | $message = "Existem relacionamentos vinculados à esse objeto. Impossível excluir."; 159 | throw new RelacionamentoException($message); 160 | $connection = null; 161 | } 162 | } 163 | 164 | /** 165 | * {@inheritDoc} 166 | */ 167 | public function delete($uid) 168 | { 169 | if (is_null($uid)) { 170 | throw new Exception("Erro ao remover registro."); 171 | } 172 | try { 173 | $connection = new PDO( 174 | DB_DSN, 175 | DB_USERNAME, 176 | DB_PASSWORD, 177 | array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION ) 178 | ); 179 | $sql = " DELETE FROM " . SCHEMA . $this->tableName . " where uid = :uid"; 180 | $stmt = $connection->prepare($sql); 181 | $stmt->bindValue(":uid", $uid, PDO::PARAM_INT); 182 | $stmt->execute(); 183 | $connection = null; 184 | } catch (Exception $e) { 185 | $message = "Existem relacionamentos vinculados à esse objeto. Impossível excluir."; 186 | throw new RelacionamentoException($message); 187 | $connection = null; 188 | } 189 | } 190 | 191 | 192 | /** 193 | * 194 | * @param string $req : the query on which link the values 195 | * @param array $array : associative array containing the values ​​to bind 196 | * @param array $typeArray : associative array with the desired value for its corresponding key in $array 197 | */ 198 | private function bindArrayValue(\PDOStatement $query, $array, $typeArray = false) 199 | { 200 | foreach ($array as $key => $value) { 201 | if ($typeArray) { 202 | $query->bindValue(":$key", $value, $typeArray[$key]); 203 | } else { 204 | $valor = $value; 205 | $param = false; 206 | if (is_int($valor)) { 207 | $param = PDO::PARAM_INT; 208 | } elseif (is_bool($valor)) { 209 | $param = PDO::PARAM_BOOL; 210 | } elseif (is_null($valor)) { 211 | $param = PDO::PARAM_NULL; 212 | } elseif (is_string($valor)) { 213 | $param = PDO::PARAM_STR; 214 | } 215 | 216 | if ($param) { 217 | $query->bindValue(":$key", $valor, $param); 218 | } 219 | } 220 | } 221 | } 222 | 223 | 224 | /** 225 | * {@inheritDoc} 226 | */ 227 | public function generate(IDataBaseCreator $creator, $create = false) 228 | { 229 | $script = $creator->scriptCreation($this->type, true); 230 | 231 | if ($create == false) { 232 | return $script; 233 | } else { 234 | // TODO extract to method 235 | try { 236 | $dbh = new PDO(DB_DSN, DB_USERNAME, DB_PASSWORD, array( PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION )); 237 | $dbh->exec($script);// or die(print_r($dbh->errorInfo(), true)); 238 | } catch (PDOException $e) { 239 | echo ("DB ERROR: ". $e->getMessage()); 240 | } 241 | } 242 | } 243 | } 244 | -------------------------------------------------------------------------------- /src/DAO/IGenericDAO.php: -------------------------------------------------------------------------------- 1 | $value) { 15 | if (property_exists($this, $key)) { 16 | $this->$key = htmlspecialchars($value); 17 | } 18 | } 19 | } 20 | 21 | 22 | public function setUID($uid) 23 | { 24 | $this->uid = $uid; 25 | } 26 | 27 | public function getUID() 28 | { 29 | return $this->uid; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Entity/Usuario.php: -------------------------------------------------------------------------------- 1 | nome; 41 | } 42 | 43 | public function setNome($nome) 44 | { 45 | $this->nome = $nome; 46 | } 47 | 48 | public function getCpf() 49 | { 50 | return $this->nome; 51 | } 52 | 53 | public function setCpf($cpf) 54 | { 55 | $this->cpf = $cpf; 56 | } 57 | 58 | public function getIdade() 59 | { 60 | return $this->idade; 61 | } 62 | 63 | public function setIdade($idade) 64 | { 65 | $this->idade = $idade; 66 | } 67 | 68 | public function getSenha() 69 | { 70 | return $this->senha; 71 | } 72 | 73 | public function setSenha($senha) 74 | { 75 | $this->senha = $senha; 76 | } 77 | 78 | public function isAtivo() 79 | { 80 | return $this->ativo; 81 | } 82 | 83 | public function setAtivo($ativo) 84 | { 85 | $this->ativo = $ativo; 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /src/Exception/RelacionamentoException.php: -------------------------------------------------------------------------------- 1 | code}]: {$this->message}\n"; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Factory/AppFactory.php: -------------------------------------------------------------------------------- 1 | getMessage()); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/Services/IDataBaseCreator.php: -------------------------------------------------------------------------------- 1 | tableName = strtolower($classe->getShortName()); 21 | if (!$classe->hasAnnotation('Table') && $classe->getAnnotation('Table') != '') { 22 | $this->tableName = strtolower($classe->getAnnotation('Table')->value); 23 | } 24 | 25 | $tabela = $this->tableName; 26 | 27 | $fields = $this->generateFields($classe->getProperties()); 28 | 29 | $script = ''; 30 | 31 | if ($showDropStatment == true) { 32 | $script .= "DROP TABLE IF EXISTS ".SCHEMA.$tabela."; \n"; 33 | } 34 | 35 | $script .= "CREATE TABLE ".SCHEMA.$tabela ." ( \n"; 36 | $uid; 37 | 38 | // TODO extract to method 39 | foreach ($fields as $key => $value) { 40 | $fkMapStatement; 41 | if (isset($value['joinTable'])) { 42 | $fkMapStatement = "\tCONSTRAINT ".$tabela."_".$value['joinTable']."_fk FOREIGN KEY($key)\n"; 43 | $fkMapStatement .= "\t\tREFERENCES ".SCHEMA.$value['joinTable']."($value[joinColumn]) MATCH SIMPLE\n"; 44 | $fkMapStatement .= "\t\tON UPDATE NO ACTION ON DELETE NO ACTION,\n"; 45 | $script .= "\t". $key . " integer, \n"; 46 | } elseif ($key == 'uid') { 47 | $script .= "\t". $key . " serial NOT NULL, \n"; 48 | $uid = $key; 49 | } else { 50 | // TODO Refactor to automatically detect the property's type 51 | $script .= "\t". $key . " " . ($value['type'] == 'integer' ? 'integer' : ($value['type'] == 'timestamp' ? 'timestamp' : 'character varying')) . ", \n"; 52 | } 53 | } 54 | $script .= @$fkMapStatement; 55 | $script .= "\tCONSTRAINT ".$tabela."_pk PRIMARY KEY (".$uid.") \n"; 56 | $script .= " );"; 57 | 58 | return $script; 59 | } 60 | 61 | 62 | private function generateFields($propriedades) 63 | { 64 | foreach ($propriedades as $propriedade) { 65 | if ($propriedade->hasAnnotation('Column')) { 66 | $key = $propriedade->getAnnotation('Column')->name; 67 | $params = (array) $propriedade->getAnnotation('Column'); 68 | foreach ($params as $chave => $valor) { 69 | $fields[$key][$chave] = $valor; 70 | } 71 | } 72 | if ($propriedade->hasAnnotation('Join')) { 73 | $params = (array) $propriedade->getAnnotation('Join'); 74 | foreach ($params as $chave => $valor) { 75 | $fields[$key][$chave] = $valor; 76 | } 77 | } 78 | } 79 | return $fields; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /test/AppTest.php: -------------------------------------------------------------------------------- 1 | assertTrue(true); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /test/functional/check-environment.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Confirmando se o ambiente está funcionando. 3 | --FILE-- 4 | generate(new PostgreSQLDataBaseCreator(), true); 40 | 41 | // Realizar operações básicas 42 | $usuario = $dao->create(); 43 | $usuario->setNome('Zé da Silva'); 44 | $usuario->setIdade(25); 45 | $usuario->setCpf('000555111'); 46 | $usuario->setSenha('123456'); 47 | $usuario->setAtivo(1); 48 | 49 | $dao->insert($usuario); 50 | 51 | 52 | $usuarios = $dao->getList(); 53 | 54 | print_r($usuarios); 55 | ?> 56 | --EXPECTF-- 57 | Array 58 | ( 59 | [0] => PseudoORM\Entity\Usuario Object 60 | ( 61 | [nome:PseudoORM\Entity\Usuario:private] => Zé da Silva 62 | [cpf:PseudoORM\Entity\Usuario:private] => 000555111 63 | [idade:PseudoORM\Entity\Usuario:private] => 25 64 | [senha:PseudoORM\Entity\Usuario:private] => 123456 65 | [ativo:PseudoORM\Entity\Usuario:private] => 1 66 | [uid:protected] => 1 67 | ) 68 | 69 | ) 70 | --------------------------------------------------------------------------------