Skip to content

Instantly share code, notes, and snippets.

View driesvints's full-sized avatar

Dries Vints driesvints

View GitHub Profile
@driesvints
driesvints / composer.json
Created November 19, 2020 10:02
Pass options to specific packages
{
"require": {
"foo/bar": {
"version": "^1.0",
"ignore-platform-req": ["php"]
}
}
}
<?php
class CashierSubscriptions implements Subscriptions
{
public function startSubscription($billable, $subscription, $plan)
{
return $billable->newSubscription($subscription, $plan)->create();
}
}
@driesvints
driesvints / config.yml
Last active September 5, 2018 09:29
Put this in a `.circleci` directory
experimental:
notify:
branches:
only:
- master
version: 2
jobs:
php7.1-5.5:
docker:
@component('mail::button', ['color' => 'green'])
Button text
@endcomponent
@driesvints
driesvints / SearchThreads.php
Created July 3, 2017 07:37
Multiple method query objects
<?php
namespace App\Queries;
use App\Models\Thread;
use Illuminate\Contracts\Pagination\Paginator;
class SearchThreads
{
public function __construct()
@driesvints
driesvints / SearchThreads.php
Last active February 13, 2020 11:13
Invokable query object
<?php
namespace App\Queries;
use App\Models\Thread;
use Illuminate\Contracts\Pagination\Paginator;
class SearchThreads
{
public function __construct()
<?php
use Illuminate\Contracts\Validation\Rule;
class ValidPaymentToken implements Rule;
{
private $gateway;
private $param1;
private $param2;
<?php
use Illuminate\Contracts\Validation\Rule;
class ValidPaymentToken implements Rule;
{
/**
* @var \CreditCardGateway
*/
private $gateway;
@driesvints
driesvints / new-relic-deployment-notifications-in-envoyer.md
Last active October 26, 2020 14:17
Setup New Relic deployment notifications in Envoyer

While Envoyer comes with Slack and Hipchat notifications out of the box we'll have to setup New Relic notifications ourselves. Luckily it's as easy as adding a deployment hook. Here's how to:

  1. Add a new hook after the "Activate New Release" hook.
  2. Add the following curl command as the script:
curl -H "x-api-key:REPLACE_WITH_YOUR_API_KEY" -d "deployment[app_name]=REPLACE_WITH_YOUR_APP_NAME" https://api.newrelic.com/deployments.xml

And that's it! Envoyer will now let New Relic know each time a deployment's made. You can be sure the deployment succeeded because it happens after the new release has been made active.