PHPackages                             upcoach/upstart-for-laravel - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. upcoach/upstart-for-laravel

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

upcoach/upstart-for-laravel
===========================

Get started developing apps quickly for the upcoach platform with this package.

v1.3.0(2y ago)695[2 PRs](https://github.com/upcoach/upstart-for-laravel/pulls)MITPHPPHP ^8.1

Since Mar 26Pushed 2y ago1 watchersCompare

[ Source](https://github.com/upcoach/upstart-for-laravel)[ Packagist](https://packagist.org/packages/upcoach/upstart-for-laravel)[ Docs](https://github.com/upcoach/upstart-for-laravel)[ RSS](/packages/upcoach-upstart-for-laravel/feed)WikiDiscussions main Synced today

READMEChangelog (5)Dependencies (14)Versions (11)Used By (0)

Get started developing apps quickly for the upcoach platform with this package.
===============================================================================

[](#get-started-developing-apps-quickly-for-the-upcoach-platform-with-this-package)

[![Latest Version on Packagist](https://camo.githubusercontent.com/3666dca2b997e8c8313f8e3f1e2d56483308ad8a18194b290515b4a26dc3ef5c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7570636f6163682f757073746172742d666f722d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/upcoach/upstart-for-laravel)[![GitHub Tests Action Status](https://camo.githubusercontent.com/5c3514caac9c4646839fc69014150e00b49fb59975f1277766e20c46c99f0ba8/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7570636f6163682f757073746172742d666f722d6c61726176656c2f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/upcoach/upstart-for-laravel/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/cb9c4c5a5df0924dfd496cf8090749491133825af9a507b4804dc17a2035562e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7570636f6163682f757073746172742d666f722d6c61726176656c2f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/upcoach/upstart-for-laravel/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/75614ab35c7c5dc34d437368994ac9f927ee8fcfe8fa259ff4b415ec7252090c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7570636f6163682f757073746172742d666f722d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/upcoach/upstart-for-laravel)

This package provides a starting point for developing applications for the upcoach platform. It contains useful components, such as an API client, request validation, and webhook controllers, to help you get started smoothly.

Features
--------

[](#features)

### Installation and Webhook Management

[](#installation-and-webhook-management)

To use this package with upcoach, you will need to provide an Installation URL and a Webhook URL in the upcoach developer portal. This package provides two endpoints in the `routes/api.php` file to handle these URLs automatically:

- `POST /api/upcoach-install`
- `POST /api/upcoach-webhooks:`

To set up your application, use the following URLs:

- `https://your-application-address.com/api/upcoach-install` for the Installation URL.
- `https://your-application-address.com/api/upcoach-webhooks` for the Webhook URL.

### Middleware for upcoach Requests

[](#middleware-for-upcoach-requests)

To validate incoming requests from upcoach, you can use the `Upcoach\UpstartForLaravel\Http\Middleware\EnsureUpcoachRequestIsValid` middleware. This middleware will validate the signature of the request, and if it is valid, it will add the installation to the request object.

### API Client

[](#api-client)

Once the app is installed, an installation request is initiated that includes an API token. This token is saved in the database through the installation model, along with other relevant information. You can utilize this token to access the required API endpoints (scoped to the installed organization) when querying the upcoach API.

Here's how you can use the provided upcoach API client:

```
$installation = Upcoach\UpstartForLaravel\Models\Installation::query()
    ->forOrganization($organizationId)
    ->firstOrFail();
```

Or if you are using the `Upcoach\UpstartForLaravel\Http\Middleware\EnsureUpcoachRequestIsValid` middleware, you can access the installation via the request object:

```
$installation = $request->installation;
```

Then you can use the upcoach API client to query the API:

```
$client =  app(Upcoach\UpstartForLaravel\Api\Client::class, [$installation]);
$programInfo = $client->getProgramInfo($programId);
```

Getting Started
---------------

[](#getting-started)

To get started with this package, you will need to follow these steps:

- Sign up for the upcoach developer program on the [upcoach developer portal](https://developers.upcoach.com).
- Create a new application on the developer portal.
- Install the package using the following command:

```
composer require upcoach/upstart-for-laravel
```

- Publish the configuration and migration files by running this command:

```
php artisan upstart-for-laravel:install
```

- Configure your Laravel application by adding the following details to your .env file:

```
UPCOACH_APP_ID=
UPCOACH_APP_SIGNING_SECRET=
```

You can find these details in the developer information section of your application on the developer portal.

Usage
-----

[](#usage)

- Complete the [Getting Started](#getting-started) steps above.
- Create a new block on the developer portal.
- Create a new route in your application to handle the block.
- Add the `Upcoach\UpstartForLaravel\Http\Middleware\EnsureUpcoachRequestIsValid` middleware to the route.

```
Route::group(['middleware' => [EnsureUpcoachRequestIsValid::class]], function () {
    Route::get('/your-block-connector-path', YourBlockController::class);
});
```

- Create a new controller for the route.

```
class YourBlockController extends Controller
{
    public function __invoke(Request $request)
    {
        /**
         * Parameters coming from the upcoach
         * app_id
         * organization_id
         * program_id
         * block_id
         * program_block_id
         * user_id
         * user_role
         */

        // You can access the installation via the request object.
        $installation = $request->installation;

        // You can use the installation to query the upcoach API if needed.
        $client = app(Upcoach\UpstartForLaravel\Api\Client::class, [$installation]);
        $programInfo = $client->getProgramInfo($request->program_id);

        // Your code here.
    }
}
```

Developer Mode &amp; Testing
----------------------------

[](#developer-mode--testing)

This package provides features to help you test your application without having to install it on the upcoach app.

### Enabling Developer Mode

[](#enabling-developer-mode)

- To enable developer mode, you can set the UPCOACH\_DEVELOPER\_MODE environment variable. When developer mode is enabled, the Client class is replaced with FakeClient, and API calls are mocked. For more information, refer to the `Upcoach\UpstartForLaravel\Mocks\FakeClient` class.

```
UPCOACH_DEVELOPER_MODE=true
```

### Simulating upcoach Requests

[](#simulating-upcoach-requests)

- You can use the `upstart:simulate` artisan command to simulate upcoach requests. This command supports interactive mode, where you can answer the questions directly in the console. Run the following command to start the interactive mode:

```
php artisan upstart:simulate
```

Alternatively, you can simulate a request directly by providing the required options. Here's an example:

```
php artisan upstart:simulate --type=block --url=your-block-connector-path
```

You can also provide a payload for overriding the default payload parameters:

```
php artisan upstart:simulate --type=block --url=your-block-connector-path --payload='{"o": "custom-organization-id"}'
```

This command is also useful for testing settings pages:

```
php artisan upstart:simulate --type=settings --url=your-settings-page
```

After running the `upstart:simulate` command, it will display the URL that you can open in your browser to simulate the request. Additionally, it will output the full command, including all payload parameters, which you can use directly from the console for subsequent requests without having to answer the questions and obtain the same URL.

Troubleshooting
---------------

[](#troubleshooting)

### CSRF Token Mismatch

[](#csrf-token-mismatch)

If you are getting a `CSRF Token Mismatch` error in the upcoach app, you can fix it by adding the following code to the `app/Http/Middleware/VerifyCsrfToken.php` file:

```
/**
     * Create a new "XSRF-TOKEN" cookie that contains the CSRF token.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  array  $config
     * @return \Symfony\Component\HttpFoundation\Cookie
     */
    protected function newCookie($request, $config)
    {
        return new Cookie(
            name: 'XSRF-TOKEN',
            value: $request->session()->token(),
            expire: $this->availableAt(60 * $config['lifetime']),
            path: $config['path'],
            domain: $config['domain'],
            secure: true,
            httpOnly: false,
            raw: false,
            sameSite: Cookie::SAMESITE_NONE
        );
    }
```

This will set the `SameSite` attribute of the CSRF cookie to `None` and set the `Secure` attribute to `true`. This will allow the upcoach app to send the CSRF cookie to your application. Otherwise, the upcoach app will not be able to send the CSRF cookie to your application in the iframe due to the `SameSite` attribute being set to `Lax` by default.

Testing
-------

[](#testing)

```
composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [upcoach](https://github.com/upcoach)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 80% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~42 days

Total

5

Last Release

1024d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/35bf079aab3c4f3fcb8ec0aab652c9d9c4c7f04ca0be21bfd5c15fb442991c0e?d=identicon)[merthurturk](/maintainers/merthurturk)

![](https://www.gravatar.com/avatar/270b3209125c76e90b0d69cff8ce85a31dc46f2b74dab1f6d2228a396f2fd313?d=identicon)[hellokfk](/maintainers/hellokfk)

---

Top Contributors

[![hellokfk](https://avatars.githubusercontent.com/u/44089201?v=4)](https://github.com/hellokfk "hellokfk (8 commits)")[![merthurturk](https://avatars.githubusercontent.com/u/1395005?v=4)](https://github.com/merthurturk "merthurturk (2 commits)")

---

Tags

laravelupcoachupstart-for-laravel

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/upcoach-upstart-for-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/upcoach-upstart-for-laravel/health.svg)](https://phpackages.com/packages/upcoach-upstart-for-laravel)
```

###  Alternatives

[nativephp/mobile

NativePHP for Mobile

1.1k75.1k90](/packages/nativephp-mobile)[spatie/laravel-health

Monitor the health of a Laravel application

87512.0M164](/packages/spatie-laravel-health)[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.8M47](/packages/spatie-laravel-pdf)[codewithdennis/filament-select-tree

The multi-level select field enables you to make single selections from a predefined list of options that are organized into multiple levels or depths.

329530.5k29](/packages/codewithdennis-filament-select-tree)[maestroerror/laragent

Power of AI Agents in your Laravel project

639159.9k](/packages/maestroerror-laragent)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
