https://github.com/flextype-components/view
View Component provides basic methods for displaying PHP views.
https://github.com/flextype-components/view
component flextype flextype-component php view
Last synced: 14 days ago
JSON representation
View Component provides basic methods for displaying PHP views.
- Host: GitHub
- URL: https://github.com/flextype-components/view
- Owner: flextype-components
- License: mit
- Created: 2018-04-24T22:15:38.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-04-30T13:44:57.000Z (about 8 years ago)
- Last Synced: 2025-09-18T05:27:47.426Z (9 months ago)
- Topics: component, flextype, flextype-component, php, view
- Language: PHP
- Homepage: http://components.flextype.org
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# View Component

[](https://github.com/flextype-components/view/blob/master/LICENSE)
View Component provides basic methods for displaying PHP views.
### Installation
```
composer require flextype-components/View
```
### Usage
```php
use Flextype\Component\View\View;
```
Create a new view object and render it.
```php
// Create new view object
$view = new View('blog/views/backend/index');
// Assign some new variables
$view->assign('msg', 'Some message...');
// Get view
$output = $view->render();
// Display view
echo $output;
```
View factory
Create new view object, assign some variables
and displays the rendered view in the browser.
```php
View::factory('blog/views/backend/index')
->assign('msg', 'Some message...')
->display();
```
Include the view file and extracts the view variables before returning the generated output.
```php
// Get view
$output = $view->render();
// Display output
echo $output;
```
Displays the rendered view in the browser.
```php
$view->display();
```
## License
See [LICENSE](https://github.com/flextype-components/view/blob/master/LICENSE)