• Stars
    star
    177
  • Rank 215,287 (Top 5 %)
  • Language
    PHP
  • License
    MIT License
  • Created almost 6 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

This package makes it easy to add early access mode to your existing application.

Laravel Early Access logo

This package makes it easy to add early access mode to your existing application. This is useful for when you want to launch a product and need to gather the email addresses of people who want early access to the application.

Take a look at contributing.md to see a to do list.

⚠️ This version supports Laravel 6 and above. Use version 1.x if you require Laravel 5 support.

Installation

Via Composer

To install via composer, run the following command in the root of your Laravel application:

$ composer require neo/laravel-early-access

Register the middleware Neo\EarlyAccess\Http\Middleware\CheckForEarlyAccessMode at the bottom of your web group middleware in app/Http/Middleware/Kernel.php.

<?php
// [...]

'web' => [
    \App\Http\Middleware\EncryptCookies::class,

    // [...]

    \Neo\EarlyAccess\Http\Middleware\CheckForEarlyAccessMode::class,
],

// [...]

Next, add/update the MAIL_* keys in your .env file. Make sure to include MAIL_FROM_* keys as it is required when sending welcome or goodbye emails to subscribers.

Also, you can optionally add the following environment variables to your .env file:

EARLY_ACCESS_ENABLED=true
EARLY_ACCESS_URL="/early-access"
EARLY_ACCESS_LOGIN_URL="/login"
EARLY_ACCESS_TWITTER_HANDLE=NeoIghodaro
EARLY_ACCESS_VIEW="early-access::index"
EARLY_ACCESS_SERVICE_DRIVER=database
EARLY_ACCESS_SERVICE_DB_TABLE=subscribers

Now migrate the required tables:

$ php artisan migrate

And publish the required assets:

$ php artisan vendor:publish --provider="Neo\EarlyAccess\EarlyAccessServiceProvider"

This will make the config, migrations, views, and assets available inside your applications directory so you can customise them.

TIP: You can append the --tag=assets flag to publish only the asset files which is required. Other available tag values are: config, translations, migrations, views and assets.

To activate early access, you can do either of the following:

  • Run the command $ php artisan early-access --activate
  • Set the EARLY_ACCESS_ENABLED to true in your .env file

TIP: Using the artisan command allows you to add IP addresses that are allowed to bypass the early access screen altogether.

$ php artisan early-access --allow=127.0.0.1 --allow=0.0.0.0

Note that logged in users will also bypass the early access screen.

Configuration

$ php artisan vendor:publish --provider="Neo\EarlyAccess\EarlyAccessServiceProvider" --tag=config

Configuration options

  • enabled - Sets whether the mode is enabled or not. In terms of priority, this is the last thing that is checked to see if the early access screen should be shown. Login status is checked, then artisan command status is checked, then this value is checked. default: false

  • url - The URL the early access screen will be shown at. The client will be redirected to this URL if they do not have access and the mode is enabled. You can set the value to / or any other existing routes. default: /early-access

  • login_url - The URL to your application's login page. This URL will automatically be bypassed even if early access mode is turned on. default: /login

  • twitter_handle - This is used when sending subscription confirmation via email. The user will have the option to tweet with the handle you specify tagged.

  • view - The early access screen view to be loaded. You can publish the views and customise it, or leave the default. default: early-access::index.

  • service - This is the subscription driver. See below for how to create your own driver. default: database.

  • services.database.table_name - The database table name. This is useful is you want to change the name of the database table. You need to do this before you run the migration though. default: subscribers

  • notifications - The default notification classes. You can use your own notification classes if you would like to change how users will be notified when they subscribe or unsubscribe.

Using / or an existing route as the early access URL

To use / or an existing route in your application as the early access URL, you need to do the following:

First, register the service provider manually below the App\Providers\RouteServiceProvider::class in config/app.php.

<?php

return [

    'providers' => [

        // [...]

        App\Providers\RouteServiceProvider::class,
        Neo\EarlyAccess\EarlyAccessServiceProvider::class,

        // [...]

    ],

    // [...]
];

Next, open your composer.json file and add the package in the dont-discover array:

// [...]

"laravel": {
    "dont-discover": [
        "neo/laravel-early-access"
    ]
},

// [...]

Now run composer dump-autoload -o and it should work.

Creating your own subscription service driver

By default, there is a database driver that manages all the users. You can decide to create your own driver though for other services like Mailchimp etc. (If you do, please consider submitting a PR with the driver).

To get started, you need to create a new class that implements the service provider class:

<?php

namespace App\Services\SubscriptionServices;

use Neo\EarlyAccess\Contracts\Subscription\SubscriptionProvider;

class MailchimpService implements SubscriptionProvider
{
    public function add(string $email, string $name = null): bool
    {
        // Implement adding a new subscriber...
    }

    public function remove(string $email): bool
    {
        // Implement removing a subscriber...
    }

    public function verify(string $email): bool
    {
        // Implement verifying a subscriber
    }

    /**
     * @return \Neo\EarlyAccess\Subscriber|false
     */
    public function findByEmail(string $email)
    {
        // Implement returning a subscriber from email
    }
}

Next, register your service in the register method of your app/Providers/AppServiceProvider class:

<?php

// [...]

$this->app->bind('early-access.mailchimp', function () {
    return new \App\Services\SubscriptionServices\MailchimpService;
});

// [...]

NOTE: Leave the early-access. namespace. It is required. Just append the name of your service to the namespace as seen above.

Next, go to your published configuration and change the service driver from database to mailchimp. That's all.

Change log

Please see the changelog for more information on what has changed recently.

Testing

$ composer test

Contributing

Please see contributing.md for details and a todolist.

Security

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

Credits

License

Please see the license file for more information.

More Repositories

1

docker-webserver

Webserver (Nginx + PHP 7) running inside a Docker container.
Shell
100
star
2

laravel-vue-cms

This is a simple CMS built upon Laravel and Vue.
PHP
92
star
3

laravel-pusher-web-notifications

An example on how to use Laravel and Pusher to create a web notification system.
PHP
83
star
4

pusher-python-realtime-dashboard

Build a realtime dashboard using Python and Pusher channels
CSS
82
star
5

laravel-docker

Getting Started With Laravel and Docker.
Shell
57
star
6

nimble

Fast PHP framework made with very loose optional components.
PHP
53
star
7

Creating-OAuth-Server-Laravel-Passport

This is an Example of how to create an OAuth server using Laravel Passport
PHP
48
star
8

little-sail

Little Sail is a smaller runtime image for Laravel Sail
Dockerfile
38
star
9

food-delivery-ios-app

A food delivery application built using Swift for iOS. The application uses Pushers notifications feature to send push notifications to mobile devices.
Swift
37
star
10

Laravel-Vue-Time-Tracker-Example

Create a time tracker using Laravel and Vue
PHP
35
star
11

trello-kanban-cards-clone

This is an example on how to make a Trello Kanban card style application with Vue and Pusher
PHP
30
star
12

python-pusher-chat-widget

Demo of a real-time chat widget powered by Python and Pusher Channels.
JavaScript
29
star
13

laravel-passport-demo

Shows you how to turn your website to an Oauth2 server using Laravel Passport
PHP
28
star
14

Handling-internet-connection-reachability-in-Swift

Here is an example on how to handle internet connectivity events in iOS
Swift
26
star
15

Angular-SEO-friendly-example

How to make your Angular 4 app SEO friendly
TypeScript
26
star
16

getting-started-webpack

Getting started with Webpack.
JavaScript
21
star
17

watchdog

Simple & Extensible Application Monitor!
PHP
21
star
18

resource-monitor

Resource uptime monitor (e.g Internet and power)
PHP
18
star
19

monitoring-laravel-queues

This is a sample on how you can monitor your Laravel background queues in realtime using Pusher.
PHP
16
star
20

python-pusher-multiplayer-game

This is a realtime multiplayer tic-tac-toe game built using Python, Pusher, and JavaScript.
HTML
16
star
21

python-pusher-traffic-monitor

Create a traffic monitor using Pusher Channels and Python
HTML
16
star
22

react-hook-todo-app

JavaScript
15
star
23

realtime-poll-go-pusher

Create a realtime poll using Go and Pusher
HTML
14
star
24

pusher-beams

Sending push notifications in Laravel projects using Pusher Beams (https://pusher.com/beams)
PHP
14
star
25

Design-Prototype-Feedback-Application

Invision-like Design Prototype Feedback Application built using Laravel Vue and Pusher
PHP
13
star
26

realtime-photofeed-pusher-go

Create a realtime photo feed using Go and Pusher
HTML
13
star
27

foundation-grunt-starter

Starter skeleton for Foundation and Grunt
JavaScript
12
star
28

hngfood

Food Order Management for Teams!
PHP
11
star
29

anonymous-ios-app-pusher

Anonymous iOS chat application using Pusher
Swift
11
star
30

go-pusher-chat-app

This is a demo of a real-time chat app powered by Go and Pusher Channels.
JavaScript
10
star
31

angular-4-status-update-reactions

How to build status update reactions using Firebase and Angular 4
TypeScript
10
star
32

go-pusher-api-monitor

A realtime API monitor written with go
Go
9
star
33

pusher-go-realtime-graph

Realtime graph with Pusher and Go
Go
9
star
34

Twootstrap

Kohana 3 Asset Manager
PHP
9
star
35

codemarker

in-house code marker
PHP
8
star
36

Collaborative-Note-taking-Application-Javascript

How to create a note-taking application using JavaScript and Node.js
JavaScript
7
star
37

realtime-collaborative-text-editor

Realtime Collaborative Text Editor in iOS and Pusher
Swift
7
star
38

sample-vue-pwa-cryptocurrency-watcher

JavaScript
7
star
39

textfaces

Source code for my TextFaces application.
Objective-C
7
star
40

create-chat-app-with-.NET-pusher

Create a chat app pusher .net
JavaScript
7
star
41

laravel-shelf-project

Start your next shelf project directly from GitHub without PHP installed on your machine.
Shell
6
star
42

facebook-messenger-bot

This is the base for creating a Facebook messenger bot. The tutorial is available on Pusher.
PHP
6
star
43

ride-sharing-app

A ride sharing application built using Swift for iOS. The application uses Pusher's notifications feature to send push notifications to mobile devices.
Swift
6
star
44

site

My website's source code
CSS
6
star
45

dotfiles

My dotfiles
Shell
6
star
46

FollowPlea

This is a drop-in library to request that anyone that installs your Tweak follow you on Twitter.
Objective-C
5
star
47

python-realtime-poll-pusher

Demo of a Python realtime poll powered by Pusher Channels.
HTML
5
star
48

hng-request

HTTP Request Library For CRS
PHP
5
star
49

placeholdr

Placeholdr Bundle For Laravel PHP Framework
PHP
5
star
50

honeypot

PHP
5
star
51

kotlin-cryptocurrency-watcher-with-push-notification

Kotlin
5
star
52

chatkit-witai-laravel

Create a custom chat bot customer support assistant using Laravel, Pusher and Wit.ai
PHP
4
star
53

rate-my-talk

PHP
4
star
54

neoish

Source code to my website
JavaScript
4
star
55

cryptocurrency-alert-ios-app

How to create a cryptiocurrency alert application using Pusher Channels, Pusher Beams, Swift and Laravel PHP
PHP
4
star
56

react-todo-sample

JavaScript
4
star
57

laravel-pusher-presence

Working with presence channels in a Laravel application
PHP
4
star
58

Using-Pusher-Chatkit-SlackTextViewController-iOS

Swift
3
star
59

UnicodeFaces

Add Unicode faces to your Keyboard.
Objective-C
3
star
60

cmpsr.co

Source code for cmpsr.co
PHP
3
star
61

twitter-dark-mode

Twitter dark mode on jailbroken iPhones
Objective-C
3
star
62

hooks

Implements the wordpress hook functionality for any application.
PHP
3
star
63

ibundle

iBundle laravel bundle on steroids.
PHP
3
star
64

getting-started-with-autolayout

Getting started with Auto Layout on iOS
Swift
3
star
65

constraint-layout-demo

Kotlin
3
star
66

kotlin-messenger-app-with-online-presence-status

Kotlin
3
star
67

kotlin-internet-connectivity-sample

Sample of how to detect internet connectivity changes in Kotlin.
Kotlin
3
star
68

message-delivery-status-ios

Create an iOS chat application with message delivery status using Pusher
Swift
3
star
69

spotify-like-currently-playing-realtime

Swift
3
star
70

pusher-post-to-markdown

Converts a Pusher blogpost to Markdown
PHP
3
star
71

Realtime-iOS-Chart

Build a realtime iOS chart using Pusher
Swift
3
star
72

liveblog-go-pusher

Demo live blog using Go and Pusher
HTML
2
star
73

chatkit-kotlin-group-messenger

Example of how to create a Kotlin messenger app using Chatkit
Kotlin
2
star
74

xctemplates

Customise your Xcode FILEHEADER template
Shell
2
star
75

realtime-ios-status-update

Example on how to implement realtime status updates on iOS using Pusher
Swift
2
star
76

logger

Laravel Logger Realtime with Mobile Apps
PHP
2
star
77

phpstorm-settings

PHP
2
star
78

kotlin-python-poll

Create a poll using Kotlin, Python, Pusher Channels and Beams
Kotlin
2
star
79

react-hooks-samples

HTML
2
star
80

laravel-github-gist

Simple GitHub Gist API
PHP
2
star
81

stock-app

Kotlin
2
star
82

switcher-issues

Report issues to the Switcher tweak
2
star
83

go-pusher-presence-app

This is a demo on how to integrate realtime presence using Go, JavaScript and Pusher.
HTML
2
star
84

realtime-login-approval-system

How to build a realtime login approval system with Push Notifications using Pusher
PHP
2
star
85

ephemeral-chat-app-android

Ephemeral messaging using Chatkit for Android
Kotlin
1
star
86

realtime-map-example-kotlin

How to build a realtime map using Kotlin and Pusher
Kotlin
1
star
87

migrate-layer-pusher

Kotlin
1
star
88

realtime-online-counter-on-ios

Create a realtime counter on iOS using Pusher
Swift
1
star
89

todo-watch-app

Swift
1
star
90

BBMCallConfirm

A tweak for jailbroken iPhones written in Objective-C
Logos
1
star
91

Build-a-realtime-table-using-Swift

How to build a realtime table in iOS using Pusher
Swift
1
star
92

Sanity

Extensible Sanitizer for input array values.
PHP
1
star
93

Whos-Typing-In-.NET

How to do a who's typing feature in .NET
JavaScript
1
star
94

jumper-icons

Jumper icons
1
star
95

Realtime-Floating-Hearts-iOS-Pusher

Build a realtime floating hearts like feature just like Instagram live has using Pusher and Swift.
Swift
1
star
96

neoighodaro

Meh.
1
star
97

realtime-map-dotnet

Example of creating a realtime map using .net
C#
1
star
98

Sample-Realtime-Map-on-iOS

This sample demonstrates how you can create a realtime map on iOS using Pusher
Swift
1
star
99

ios-news-app-push-notifications-demo

Sample iOS News Application to Demo Pusher's Push Notifications SDK.
PHP
1
star
100

realtime-nfl-scores

A simple Chrome extension to simulate the NFL scores in real-time
JavaScript
1
star