├── .gitignore ├── LICENSE ├── README.md ├── composer.json ├── phpunit.xml ├── src └── Analyze │ └── Application.php └── tests ├── Application └── ApplicationTest.php └── bootstrap.php /.gitignore: -------------------------------------------------------------------------------- 1 | /vendor/ 2 | composer.lock 3 | .DS_Store -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Analyze Framework 2 | 3 | This is a work in progress. Follow along below and at [@AnalyzePHP](http://twitter.com/AnalyzePHP). 4 | 5 | # The Analyze PHP Framework Blog 6 | [Part 1 - Why, Seriously Why?](https://developmentmatt.com/building-a-php-framework-part-1-why-seriously-why/) 7 | 8 | [Part 2 - What is a Web Framework](https://developmentmatt.com/building-a-php-framework-part-2-what-is-a-web-framework/) 9 | 10 | [Part 3 - Time For Action](https://developmentmatt.com/building-a-php-framework-part-3-time-for-action/) 11 | 12 | [Part 4 - The Foundation](https://developmentmatt.com/building-a-php-framework-part-4-the-foundation/) 13 | 14 | [Part 5 - Test Driven Development](https://developmentmatt.com/building-a-php-framework-part-5-test-driven-development/) 15 | 16 | [Part 6 – Dependency Inversion, Inversion of Control, oh my!](https://developmentmatt.com/building-a-php-framework-part-6-dependency-inversion-inversion-of-control-oh-my/) 17 | 18 | [Part 7 - The Container](https://developmentmatt.com/building-a-php-framework-part-7-the-container/) 19 | 20 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "analyzephp/framework", 3 | "description": "The Analyze PHP Framework", 4 | "type": "library", 5 | "license": "MIT", 6 | "authors": [ 7 | { 8 | "name": "Matt Sparks", 9 | "email": "matt@sparkscoding.com" 10 | } 11 | ], 12 | "autoload": { 13 | "psr-4": { 14 | "Analyze\\": "src/Analyze/", 15 | "Tests\\Utilities\\": "tests/Utilities" 16 | } 17 | }, 18 | "minimum-stability": "dev", 19 | "require-dev": { 20 | "phpunit/phpunit": "^7.2@dev", 21 | "mockery/mockery": "^1.0@dev" 22 | }, 23 | "require": { 24 | "psr/container": "^1.0@dev", 25 | "analyzephp/container": "dev-master" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ./tests 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/Analyze/Application.php: -------------------------------------------------------------------------------- 1 | 8 | */ 9 | namespace Analyze; 10 | 11 | use Analyze\Container\Container; 12 | use Psr\Container\ContainerInterface; 13 | 14 | class Application 15 | { 16 | /** 17 | * Analyze PHP Framework Version 18 | * @var string 19 | */ 20 | const VERSION = '0.0.1-alpha'; 21 | 22 | /** 23 | * Container 24 | * @var Psr\Container\ContainerInterface 25 | */ 26 | private $container; 27 | 28 | /** 29 | * Constructor 30 | */ 31 | public function __construct() 32 | { 33 | $this->setContainer(new Container); 34 | } 35 | 36 | /** 37 | * Get Container 38 | * 39 | * @return ContainerInterface 40 | */ 41 | public function getContainer() : ContainerInterface 42 | { 43 | return $this->container; 44 | } 45 | 46 | /** 47 | * Get Version 48 | * 49 | * @return string 50 | */ 51 | public function getVersion() : string 52 | { 53 | return static::VERSION; 54 | } 55 | 56 | /** 57 | * Set Container 58 | * 59 | * @param ContainerInterface $container 60 | */ 61 | public function setContainer(ContainerInterface $container) : void 62 | { 63 | $this->container = $container; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /tests/Application/ApplicationTest.php: -------------------------------------------------------------------------------- 1 | assertInstanceOf(Application::class, $app); 13 | } 14 | 15 | public function testApplicationVersionIsReturned() 16 | { 17 | $app = new Application; 18 | 19 | $this->assertTrue(is_string($app->getVersion())); 20 | } 21 | 22 | public function testApplicationReturnsContainer() 23 | { 24 | $app = new Application; 25 | 26 | $this->assertInstanceOf(ContainerInterface::class, $app->getContainer()); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /tests/bootstrap.php: -------------------------------------------------------------------------------- 1 |