Download the PHP package elshaden/popup-card without Composer

On this page you can find all versions of the php package elshaden/popup-card. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package popup-card

Laravel Nova Popup Card

Latest Version on Packagist Total Downloads License GitHub Stars

A customizable popup modal card for Laravel Nova that automatically displays to users when they access your dashboard or resource pages. Perfect for welcome messages, announcements, notifications, and more.

🌟 Features

Example

Here's an example of how a welcome popup from ACME Company might look:

Note: Create this image based on the specifications in docs/images/sample-popup-instructions.md

Compatibility

Installation

You can install the package in Laravel Nova app that uses Nova via composer:

Package Registration

The package will be automatically registered using Laravel's package auto-discovery. However, if you have disabled auto-discovery, you need to manually register the package's service provider in your config/app.php file:

Configuration

You can publish the config file with:

Database Table Configuration

The package allows you to customize the database table names and foreign keys used by the popup card system. This is useful if you need to avoid table name conflicts or follow specific naming conventions in your application.

Available configuration options:

Example: Customizing Table Names

If you want to use custom table names, you can modify these values in your published configuration file:

After changing these values, make sure to run the migrations to create the tables with your custom names.

Configuration Content

Migrations

You can publish the migration with:

After publishing the migration, you can create the necessary database tables by running the migrations:

This will create two tables:

Usage

Basic Setup

  1. Add the Trait to Your User Model

You MUST add the HasPopupCards trait to your user model. This enables tracking which users have seen which popups:

  1. Register the Resource in Nova's Menu

Add the PopupCard resource to your Nova menu to manage popup cards:

Adding Popup Cards to Pages

You can add popup cards to your dashboard or any resource page. The popup will automatically display when users visit that page.

Important: The name you use in the ->name() method must match the name of an existing popup card in your database. You need to create the popup card first using the Nova admin panel before you can display it in your code.

Dashboard Example

In this example, a popup card with the name "welcome-message" must already exist in your database.

Resource Example

Similarly, a popup card with the name "user-instructions" must already exist in your database.

Customizing Display Conditions

You can control who sees the popup using Nova's canSee() method:

In this example, a popup card with the name "2fa-reminder" must already exist in your database. This popup would only be shown to users who don't have two-factor authentication enabled.

Width Options

You can customize the width of your popup card using one of these options:

How It Works: Complete Workflow

Here's a step-by-step explanation of how the popup card system works:

  1. Create a Popup Card in Nova Admin Panel

    • Navigate to the PopupCard resource in your Nova admin panel
    • Click "Create Popup Card"
    • Fill in the required fields:
      • Name: A unique identifier (e.g., "2fa-reminder") - this is crucial!
      • Title: The title displayed at the top of the popup
      • Body: The content of the popup (supports HTML)
    • Set "Published" and "Active" to true
    • Save the popup card

      1. Reference the Popup Card in Your Code
        • In your dashboard or resource file, add the PopupCard to the cards method
        • Use the exact same name you specified in the admin panel:
        • Optionally add conditions using canSee() to control who sees the popup
  2. User Experience
    • When a user visits the page, the system checks if there's an active popup card with the specified name
    • If found and the user hasn't seen it before, the popup is displayed
    • The user can close the popup or choose not to see it again

This name-based reference system allows you to create different popup cards for different parts of your application and control them centrally through the Nova admin panel.

Managing Popup Cards

Using the PopupCard resource in Nova, you can:

Creating Popup Cards

When creating a popup card in the Nova admin panel

  1. The name field must be unique for each popup card
  2. This name is used to reference the popup card in your code via the ->name() method
  3. The popup card must be created in the admin panel before it can be displayed in your code

User Interaction

The system will automatically show the latest active and published popup card to users when they access the page where the popup is configured. Users can:

Testing

This package includes a comprehensive test suite. To run the tests:

  1. Install development dependencies:

  2. Run the tests:

Available Test Suites

Test Coverage

Generate a test coverage report:

For more detailed information about testing, including how to run tests from a project that has installed this package (using either PHPUnit or Pest PHP), refer to the README-testing.md file.

If you encounter any issues while using this package, please check the README-troubleshooting.md file for common solutions.

License

The MIT License (MIT). Please see License File for more information.

Credits

Contributing

Please feel free to fork this package and contribute by submitting a pull request to enhance the functionalities. See CONTRIBUTING.md for detailed guidelines on how to contribute.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker. All security vulnerabilities will be promptly addressed.

Support

Thank you for using this package! If you encounter any issues or have questions:

  1. Check the README-troubleshooting.md file for common solutions
  2. Search the issue tracker to see if your issue has already been reported
  3. Open a new issue with a clear description and reproduction steps if needed

All versions of popup-card with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0|^8.1|^8.2
laravel/nova Version ^4.0|^5.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package elshaden/popup-card contains the following files

Loading the files please wait ...