Skip to content

Commit

Permalink
Merge pull request #275 from ash-jc-allen/8.0-doc-updates
Browse files Browse the repository at this point in the history
8.0 doc updates
  • Loading branch information
ash-jc-allen authored Apr 26, 2024
2 parents c896cfa + efb7fb9 commit ab5b180
Show file tree
Hide file tree
Showing 3 changed files with 279 additions and 19 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Changelog

**v8.0.0 (released 2024-04-XX):**

- Switch from `jenssegers/agent` to `whichbrowser/parser` for user agent parsing. [#261](https://github.com/ash-jc-allen/short-url/pull/261), [#256](https://github.com/ash-jc-allen/short-url/pull/256)
- Added property types and strict type-checking. [#265](https://github.com/ash-jc-allen/short-url/pull/265)
- Added support for PHPUnit 11. [#268](https://github.com/ash-jc-allen/short-url/pull/268)
- Added Pest architecture tests. [#274](https://github.com/ash-jc-allen/short-url/pull/274)
- Dropped support for PHP 8.0. [#257](https://github.com/ash-jc-allen/short-url/pull/257)
- Dropped support for Laravel 8 and 9. [#257](https://github.com/ash-jc-allen/short-url/pull/257)
- Dropped support for PHPUnit 8 and 9. [#268](https://github.com/ash-jc-allen/short-url/pull/268)
- Switched from "nunomaduro/larastan" to "larastan/larastan". [#267](https://github.com/ash-jc-allen/short-url/pull/267)
- Removed the `date` property from the `ShortURL` and `ShortURLVisit` models. [#266](https://github.com/ash-jc-allen/short-url/pull/266)
- Abstract the key generator out to use an interface. [#262](https://github.com/ash-jc-allen/short-url/pull/262)
- Updated the facade to include all methods in the docblock. [#252](https://github.com/ash-jc-allen/short-url/pull/252)

Huge thank you to [@stevebauman](https://github.com/stevebauman) and [@marzvrover](https://github.com/marzvrover) for their contributions in this release. I really appreciate it! 🚀

**v7.10.0 (released 2024-03-19):**

- Added support for nesbot/carbon 3.0. [#246](https://github.com/ash-jc-allen/short-url/pull/246)
Expand Down
28 changes: 27 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
- [Tracking Fields](#tracking-fields)
- [Config Validation](#config-validation)
- [Custom Database Connection](#custom-database-connection)
- [Specifying the Key Generator](#specifying-the-key-generator)
- [Specifying the User Agent Parser](#specifying-the-user-agent-parser)
- [Helper Methods](#helper-methods)
- [Visits](#visits)
- [Find by URL Key](#find-by-url-key)
Expand Down Expand Up @@ -600,6 +602,30 @@ To do this, you can set the connection name using the `connection` config value
'connection' => 'custom_database_connection_name',
```

#### Specifying the Key Generator

By default, Short URL uses the `AshAllenDesign\ShortURL\Classes\KeyGenerator` class to generate the keys for the short URL. However, you may want to use your own custom key generator class.

To do this, you can define the class to be used in the `short-url.php` config file like so:

```php
'url_key_generator' => \AshAllenDesign\ShortURL\Classes\KeyGenerator::class,
```

You'll just need to ensure that your custom key generator class implements the `AshAllenDesign\ShortURL\Interfaces\KeyGenerator` interface.

#### Specifying the User Agent Parser

By default, Short URL uses `whichbrowser/parser` package to parse the user agent header of the visitor when tracking visits. However, you may want to use your own custom user agent parser.

To do this, you can define the class to be used in the `short-url.php` config file like so:

```php
'user_agent_driver' => \AshAllenDesign\ShortURL\Classes\UserAgent\ParserPhpDriver::class,
```

You'll just need to ensure that your custom user agent parser class implements the `AshAllenDesign\ShortURL\Interfaces\UserAgentDriver` interface.

### Helper Methods
#### Visits
The ShortURL model includes a relationship (that you can use just like any other Laravel model relation) for getting the
Expand Down Expand Up @@ -653,7 +679,7 @@ The following example shows how to get an array of all tracking-enabled fields f
```php
$shortURL = \AshAllenDesign\ShortURL\Models\ShortURL::first();
$shortURL->trackingFields();
```
```

### Model Factories

Expand Down
Loading

0 comments on commit ab5b180

Please sign in to comment.