Skip to content

Commit

Permalink
updated docs, removed 8.1 attempted tests and ready for release 2.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
robclancy committed Feb 15, 2023
1 parent fa9e51d commit 7547606
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/php8-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
fail-fast: true
matrix:
php: ['8.0', 8.1]
php: ['8.0']

name: PHP ${{ matrix.php }}

Expand Down
25 changes: 13 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,21 @@ This library provides a simple class to help make a `Presenter` for your objects

## Installation

### Composer
```bash
composer require robclancy/presenter:^2.0
```
or

Add `robclancy/presenter` to the "require" section of your `composer.json` file.

```json
"robclancy/presenter": "2.0.*"
"robclancy/presenter": "^2.0"
```

Run `composer update` to get the latest version of the package.


### Manually

It's recommended that you use Composer, however you can download and install from this repository.


### Laravel

This package comes with an optional service provider for Laravel 5.8+ so that you can automate some extra steps. You will need to have installed using the composer method above, then register the service provider with your application.
This package comes with an optional service provider for Laravel 5.8+ < Laravel 10 so that you can automate some extra steps. You will need to have installed using the composer method above, then register the service provider with your application.

Open `app/config/app.php` and find the `providers` key. Add
```
Expand All @@ -55,7 +51,6 @@ to the array at some point after

Now presenters will automatically be created if using the <a href="#laravel-usage">laravel method</a> described below.


## Usage

`Presenter` is a very simple class that overloads methods and variables so that you can add extra logic to your objects or arrays without adding view logic to areas like your models or controllers and also keeps any extra logic out of your views.
Expand All @@ -76,7 +71,7 @@ class UserPresenter extends Robbo\Presenter\Presenter {
```

Now our view should receive an instance of this presenter which would be created with something like `$user = new UserPresenter(new User);`. If we want to link to the users page all we have to do is call `$user->url()`. Now you have good separation of logic and an easy little class you can modify to add properties to your `User` in all areas.
However you might not want to be calling methods like this, it could be inconsistent with what you are doing or you might want the code to look a little cleaner. That is where methods with the `present` prefix come in. All we do is update the presenter to the following.
However, you might not want to be calling methods like this, it could be inconsistent with what you are doing, or you might want the code to look a little cleaner. That is where methods with the `present` prefix come in. All we do is update the presenter to the following.

```php

Expand Down Expand Up @@ -266,6 +261,12 @@ And that is all there is to it. You can easily automate the creation of presente

## Change Log

#### 2.0.1

- branched off 2.x to support < PHP 8.1
- modernized the repository somewhat
- updated documentation

#### 2.0.0

- minimum Laravel version is now 5.8
Expand Down

0 comments on commit 7547606

Please sign in to comment.