PHPackages                             ylsideas/laravel-additions - 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. [Framework](/categories/framework)
4. /
5. ylsideas/laravel-additions

ActiveLibrary[Framework](/categories/framework)

ylsideas/laravel-additions
==========================

A package of customisations for the Laravel Framework

v0.1(6y ago)14MITPHPPHP ^7.2.5

Since May 4Pushed 6y ago1 watchersCompare

[ Source](https://github.com/ylsideas/laravel-additions)[ Packagist](https://packagist.org/packages/ylsideas/laravel-additions)[ Docs](https://github.com/ylsideas/laravel-additions)[ RSS](/packages/ylsideas-laravel-additions/feed)WikiDiscussions stable Synced 3d ago

READMEChangelog (1)Dependencies (4)Versions (2)Used By (0)

Laravel Additions
=================

[](#laravel-additions)

[![Latest Version on Packagist](https://camo.githubusercontent.com/dbbe674d5d7ca1f6092b4529cb5d925fbd14ebebe2056ddd3adaf5d1031837bc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f796c7369646561732f6c61726176656c2d6164646974696f6e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ylsideas/laravel-additions)[![Build Status](https://camo.githubusercontent.com/1002331b3a47e97513e3bd4b69138319a82d2de7ca1e8b843550036d91aa4b3b/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f796c7369646561732f6c61726176656c2d6164646974696f6e732f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/ylsideas/laravel-additions)[![Quality Score](https://camo.githubusercontent.com/a059ac271b12d81ebbd91accd137f39f73594492c51aea2028f649fb84b0a1d0/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f796c7369646561732f6c61726176656c2d6164646974696f6e732e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/ylsideas/laravel-additions)[![Total Downloads](https://camo.githubusercontent.com/aad503b2fca13be1c2f05809f50bcdacc2577cadca59ff082be7cebe4e9230c5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f796c7369646561732f6c61726176656c2d6164646974696f6e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ylsideas/laravel-additions)

A package of developer tools and tweaks that can be used with Laravel 7.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require --dev ylsideas/laravel-additions
```

Why?
----

[](#why)

I found myself doing common things in projects or just wanting a few of my custom choices in the development product.

Usage
-----

[](#usage)

### Quick install for Macros and Helper files.

[](#quick-install-for-macros-and-helper-files)

The following command can be used to create new php files for helpers and macros. These files will be added to the composer.json file and the `composer dumpautoload` command will be ran afterwards.

```
php artisan configure --macros --helpers
```

### Publish Stubs

[](#publish-stubs)

This library adds additional stubs over the defaults in Laravel 7 as of 19/4/20. Such additions are notifications and events stubs.

You can set the stubs directory of where to publish the stub using the app.php config.

```
'stub_path' => resource_path(),
```

Running `php artisan stub:publish` will place the stubs in the `resources/stubs/` path. There you can edit the stubs that will be used for making new classes.

### Testing Trait Hooks

[](#testing-trait-hooks)

Often you might want to use traits with tests to work with certain aspects. You can now use traits with annotations `@afterAppCreated` and `@beforeAppDestroyed` which hooks into the feature tests and calls the methods specified making it easy to switch functionality in and out for tests.

For example, you could create the trait:

```
trait WithSomething
{
    use \YlsIdeas\LaravelAdditions\Testing\WithApplicationTraitHooks;

    protected $user;

    /**
     * @afterAppCreated
     */
    public function createUser()
    {
        $this->user = factory(User::class)->create();
    }

    public function actingByDefault()
    {
        return $this->actingAs($this->user);
    }
}
```

Then in your test you can apply the trait knowing the `@afterAppCreated` annotation will be executed providing a new user allowing you to reject some boiler plate.

```
class SomethingTest extends \Tests\TestCase
{
    use WithSomething;

    public function testSomething()
    {
        $this->actingByDefault()
            ->get('/home')
            ->assertOk();
    }
}
```

In fact a trait that works like this already exists in this set of tools, the `WithUserAuthentication`trait. Even tests in this package use these annotations to run setups of the test.

### Setup command &amp; Testing hooks

[](#setup-command--testing-hooks)

You can create a simple function to set up an application. This is useful if you want to be able to run multiple commands and other tasks. There is also an initial flag which can be used to denote the application is being set up for the first time. This command is designed to be used for local development. To make the setup command you should do the following:

```
php artisan configure --hooks
```

This will create a `LaravelAdditionsServerProvider` in your application's Providers folder. You can then customise the setup hooks as well as the before and after test hook which will fire when you use the `php artisan test` command. The default hooks look like the following:

```
class LaravelAdditionsServiceProvider extends LaravelAdditionsHooksServiceProvider
{
    public function onSetup(bool $initial, Command $command) {
        $command->call('migrate:fresh', ['--seed' => true]);

        return true;
    }

    public function beforeTesting(InputInterface $input, OutputInterface $output) {
        $output->writeln('Starting...');
    }

    public function afterTesting(bool $passed, InputInterface $input, OutputInterface $output) {
        $output->writeln('Complete!');
    }
}
```

### Test views generated by Mailable/Notification assertions

[](#test-views-generated-by-mailablenotification-assertions)

When testing a Mailable or Notification has been sent, the rendered view can have assertions made via a factory class which will build a callable to detect the email type, render it into HTML and then provide a ViewAssertion instance that you can perform assertions on.

```
class TestCase {
    public function testMailable()
    {
        Mail::fake();
        $mailable = new MailType();
        $mailable->send();
        Mail::assertSent(MailableType::class, MailViewAssertion::make(function (ViewAssertion $assertion) {
            $assertion->contains('Hello World!');
        }));
    }

    public function testMailable()
    {
        Notification::fake();
        $notification = new ExampleNotification();
        $user->notify($notification);
        Notification::assertSentTo(
            $user,
            ExampleNotification::class,
            MailViewAssertion::make(function (ViewAssertion $assertion) {
                $assertion->contains('Hello World!');
            })
        );
    }

}
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

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

[](#contributing)

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

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Peter Fox](https://github.com/peterfox)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

Laravel Package Boilerplate
---------------------------

[](#laravel-package-boilerplate)

This package was generated using the [Laravel Package Boilerplate](https://laravelpackageboilerplate.com).

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

2202d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0b739c85248a287e7318fd7098806a90c5b8aa7e91d99e493628597eee6520e9?d=identicon)[YlsIdeas](/maintainers/YlsIdeas)

---

Top Contributors

[![peterfox](https://avatars.githubusercontent.com/u/1716506?v=4)](https://github.com/peterfox "peterfox (18 commits)")

---

Tags

laravelylsideas

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ylsideas-laravel-additions/health.svg)

```
[![Health](https://phpackages.com/badges/ylsideas-laravel-additions/health.svg)](https://phpackages.com/packages/ylsideas-laravel-additions)
```

###  Alternatives

[laravel/socialite

Laravel wrapper around OAuth 1 &amp; OAuth 2 libraries.

5.7k96.9M674](/packages/laravel-socialite)[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.2k84.2M225](/packages/laravel-horizon)[laravel/ui

Laravel UI utilities and presets.

2.7k134.9M601](/packages/laravel-ui)[laravel/sail

Docker files for running a basic Laravel application.

1.9k186.9M1.0k](/packages/laravel-sail)[laravel/jetstream

Tailwind scaffolding for the Laravel framework.

4.1k19.8M136](/packages/laravel-jetstream)[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k36.7M259](/packages/laravel-dusk)

PHPackages © 2026

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