PHPackages                             penance316/laravel-ajax-only-middleware - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. penance316/laravel-ajax-only-middleware

ActiveLibrary[HTTP &amp; Networking](/categories/http)

penance316/laravel-ajax-only-middleware
=======================================

laravel middleware to allow ajax only calls

v1.0(8y ago)16.5kMITPHPPHP &gt;=5.4.0

Since Jan 3Pushed 8y agoCompare

[ Source](https://github.com/penance316/laravel-ajax-only-middleware)[ Packagist](https://packagist.org/packages/penance316/laravel-ajax-only-middleware)[ RSS](/packages/penance316-laravel-ajax-only-middleware/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Laravel Ajax Only Middleware
============================

[](#laravel-ajax-only-middleware)

Description
-----------

[](#description)

A small middleware that prevents routes being access unless via AJAX methods.

Install
-------

[](#install)

```
composer require "penance316/laravel-ajax-only-middleware"

```

Register the middleware with you app in `app/Http/Kernal.php`

```
  /**
    * The application's route middleware.
    *
    * @var array
    */
    protected $routeMiddleware = [
        //... existing code
        'ajax' => Penance316\Middleware\AjaxOnly::class,
    ];
}

```

Attach middleware to any routes you want to be accessible only via AJAX requests

```
// File: routes.php
get('someitem/{id}', ['middleware' => 'ajax', 'uses' => 'SomeController@show']);

```

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity58

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

3105d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e92ea800ea3bab3f63624d43fd6172cc141357c2dc991333c3c105d077a05636?d=identicon)[penance316](/maintainers/penance316)

---

Top Contributors

[![penance316](https://avatars.githubusercontent.com/u/7299871?v=4)](https://github.com/penance316 "penance316 (1 commits)")

---

Tags

middlewarelaravelajax

### Embed Badge

![Health badge](/badges/penance316-laravel-ajax-only-middleware/health.svg)

```
[![Health](https://phpackages.com/badges/penance316-laravel-ajax-only-middleware/health.svg)](https://phpackages.com/packages/penance316-laravel-ajax-only-middleware)
```

###  Alternatives

[matthewbdaly/laravel-etag-middleware

A Laravel middleware for adding ETags to HTTP requests to improve response times

64331.3k2](/packages/matthewbdaly-laravel-etag-middleware)[tomschlick/request-migrations

HTTP Request Migrations

1844.5k](/packages/tomschlick-request-migrations)[shin1x1/laravel-force-https-url-scheme

Force https url schema middleware for Laravel 5

2726.6k](/packages/shin1x1-laravel-force-https-url-scheme)[brightfish/caching-guzzle

Cache HTTP responses through Guzzle middleware

1032.4k](/packages/brightfish-caching-guzzle)

PHPackages © 2026

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