Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
freekmurze committed Mar 3, 2022
1 parent 2547e54 commit 06ead83
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
20 changes: 18 additions & 2 deletions docs/installation-in-your-project/framework-agnostic-php.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,24 @@ title: Framework agnostic PHP
weight: 2
---

To start using Ray in any PHP project, install the `ray` package.
## Global installation

To make the `ray()`, `dump()` and `ray()` functions available in an PHP file and project on your system, you can install the `spatie/global` package.

```bash
composer global require spatie/global-ray
global-ray install
```

You can now use all of `ray()`'s [framework agnostic capabilities](https://spatie.be/docs/ray/v1/usage/framework-agnostic-php-project).

To use framework specific functionality, such as [viewing queries in Laravel](https://spatie.be/docs/ray/v1/usage/laravel#showing-queries), or [displaying mails in WordPress](https://spatie.be/docs/ray/v1/usage/wordpress#displaying-mails), you should still [install the relevant package or library](https://spatie.be/docs/ray/v1/installation-in-your-project/introduction).

If a framework specific package is detected, it will be used instead of the global Ray.

## Installation in a single project

To start using Ray in a single PHP project, install the `ray` package in the project.

```bash
composer require spatie/ray
Expand All @@ -12,4 +29,3 @@ composer require spatie/ray
You should be able to use the `ray` function without any other steps.

If you use Laravel, you should use install [the Laravel specific package](/docs/ray/v1/installation-in-your-project/laravel) instead of `spatie/ray`.

2 changes: 1 addition & 1 deletion docs/installation-in-your-project/laravel.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ If you use Laravel, this is the way.
composer require spatie/laravel-ray
```

By installing Ray this way it will also be installed in your production environment. This way your application will not break if you forget to remove a `ray` call. The package will not attempt to transmit information to Ray when the app environment is set to `production`.
By installing Ray like this it will also be installed in your production environment. This way your application will not break if you forget to remove a `ray` call. The package will not attempt to transmit information to Ray when the app environment is set to `production`.

You could opt to install `laravel-ray` as a dev dependency. If you go this route, make sure to remove every `ray` call in the code before deploying.

Expand Down
2 changes: 1 addition & 1 deletion src/Origin/DefaultOriginFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function getOrigin(): Origin
protected function getFrame()
{
$frames = $this->getAllFrames();
print_r($frames);

$indexOfRay = $this->getIndexOfRayFrame($frames);

return $frames[$indexOfRay] ?? null;
Expand Down

0 comments on commit 06ead83

Please sign in to comment.