PHPackages                             telkins/laravel-inquiry - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. telkins/laravel-inquiry

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

telkins/laravel-inquiry
=======================

A (somewhat opinionated) Laravel package to help make asking questions and getting answers a little easier and more uniform.

v0.8.0(3y ago)274MITPHPPHP ^8.0CI failing

Since Feb 25Pushed 2y ago1 watchersCompare

[ Source](https://github.com/telkins/laravel-inquiry)[ Packagist](https://packagist.org/packages/telkins/laravel-inquiry)[ Docs](https://github.com/telkins/laravel-inquiry)[ RSS](/packages/telkins-laravel-inquiry/feed)WikiDiscussions master Synced yesterday

READMEChangelog (8)Dependencies (2)Versions (9)Used By (0)

A (somewhat opinionated) Laravel package to help make asking questions and getting answers a little easier and more uniform.
============================================================================================================================

[](#a-somewhat-opinionated-laravel-package-to-help-make-asking-questions-and-getting-answers-a-little-easier-and-more-uniform)

[![Latest Version on Packagist](https://camo.githubusercontent.com/90233b6961d31495a05e6062125e8729286595d54a683ce3453640cf64486701/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f74656c6b696e732f6c61726176656c2d696e71756972792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/telkins/laravel-inquiry)[![GitHub Tests Action Status](https://camo.githubusercontent.com/2a09e30681230d6195e6144f68cb000ef1457fe430aad4537db83df1d9efff87/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f74656c6b696e732f6c61726176656c2d696e71756972792f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/telkins/laravel-inquiry/actions?query=workflow%3Arun-tests+branch%3Amaster)[![Quality Score](https://camo.githubusercontent.com/1eb59d68cbd87568ce577b11d661cc41be769152bb5d49a29a53be7d90e6dc0a/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f74656c6b696e732f6c61726176656c2d696e71756972792e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/telkins/laravel-inquiry)[![Total Downloads](https://camo.githubusercontent.com/f05d919d42b6a777a00b5b6874c18c459d62a0f4f997b23ad525bc469d022f71/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f74656c6b696e732f6c61726176656c2d696e71756972792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/telkins/laravel-inquiry)

From time to time you may need to make inquiries of your application or different parts of your code. You may need to know whether or not something was done or you may need to build a collection of key value pairs. Sometimes this iss provided easily via model attributes or database queries. Sometimes, however, getting this information isn't quite as tidy as you might like it.

The goal of this package is to provide a (somewhat opinionated) way to make inquiries. You can create `Inquiry` classes. When you want to make a specific inquiry, then you "ask" that class: `$myInquiry = MyInquiry::ask();`. You get back a "details" object, which you define, that allows you to provide the details of your inquiry. Then, you ask for the answer. Here's a simple example:

```
$isAllowed = CanChildPlayPS4::ask()
    ->child($junior)
    ->onDateTime(now())
    ->answer();
```

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

[](#installation)

You can install the package via composer:

```
composer require telkins/laravel-inquiry
```

Usage
-----

[](#usage)

For now, one must manually create `Inquiry` and `Details` classes.

### Create an Inquiry

[](#create-an-inquiry)

To create an inquiry class, simply extend `Inquiry` like so:

```
use Telkins\LaravelInquiry\Inquiry;
use Telkins\LaravelInquiry\Contracts\Details;

class CanChildPlayPS4 extends Inquiry
{
    public function provideAnswer(Details $details)
    {
        if (! $details->child->areChoresDone()) {
            return false;
        }

        if ($details->child->isGrounded()) {
            return false;
        }

        if (! $details->child->isDoneWithHomework()) {
            return false;
        }

        return $this->isItAGoodTimeToPlay($details->dateTime);
    }

    // supporting methods, if needed...
}
```

### Create Inquiry Details

[](#create-inquiry-details)

To create an inquiry detail classs, simply extend `Details` like so:

```
use App\Child;
use Carbon\CarbonImmutable;
use Telkins\LaravelInquiry\Details;

class CanChildPlayPS4Details extends Details
{
    public $child;
    public $dateTime;

    public function child(Child $child): self
    {
        $this->child = $child;

        return $this;
    }

    public function onDateTime(CarbonImmutable $dateTime): self
    {
        $this->dateTime = $dateTime;

        return $this;
    }
}
```

### "Ask" Your Question, Get an Answer

[](#ask-your-question-get-an-answer)

Once you have built your inquiry and inquiry details classes, then you can begin to use them. There are three main steps to asking your question and getting an answer:

1. Call the static `ask()` method on your `Inquiry` class. This returns the inquiry's details object.
2. Using the details object, provide the details of the inquiry.
3. Finally, request the answer by calling the `answer()` method on the details object.

Here is an example of asking and getting an answer all at once:

```
$isAllowed = CanChildPlayPS4::ask()
    ->child($junior)
    ->onDateTime(now())
    ->answer();
```

Here is an example of using the details object to provide different details to get different answers for different scenarios:

```
$inquiryDetails = CanChildPlayPS4::ask();

$canGregPlay = $inquiryDetails
    ->child($greg)
    ->onDateTime(now())
    ->answer();

$canPeterPlay = $inquiryDetails
    ->child($peter)
    ->answer();
```

Conventions
-----------

[](#conventions)

By default, each `Inquiry` class will look for a "details" class that has the same FQCN with `Details` appended. So, for our example `CanChildPlayPS4` class, it will look for `CanChildPlayPS4Details`.

To override this behavior, you can specify the "details" class name in your `Inquiry` class like so:

```
use Telkins\LaravelInquiry\Inquiry;
use Telkins\LaravelInquiry\Contracts\Details;
use My\Custom\Namespace\UnconventionalNameDetails;

class CanChildPlayPS4 extends Inquiry
{
    protected static $detailsClass = UnconventionalNameDetails::class; // override default "details" class

    public function provideAnswer(Details $details)
    {
        // ...
    }

    // ...
}
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

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

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

[](#contributing)

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

Security
--------

[](#security)

If you discover any security related issues, please use the issue tracker.

Credits
-------

[](#credits)

- [Travis Elkins](https://github.com/telkins)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

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

Every ~120 days

Recently: every ~210 days

Total

8

Last Release

1424d ago

PHP version history (3 changes)v0.1.0PHP ^7.4

v0.7.0PHP ^7.4 || ^8.0

v0.8.0PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/d0099a02e09e4fd03c5aca40dd7cc943391d0333009959c276321e59f6423965?d=identicon)[travis.elkins](/maintainers/travis.elkins)

---

Top Contributors

[![telkins](https://avatars.githubusercontent.com/u/53731?v=4)](https://github.com/telkins "telkins (13 commits)")

---

Tags

hacktoberfestlaravelqueryquestionanswerinquiryasktelkinsinterrogatelaravel-inquiry

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/telkins-laravel-inquiry/health.svg)

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

###  Alternatives

[livewire/volt

An elegantly crafted functional API for Laravel Livewire.

4195.3M84](/packages/livewire-volt)[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11320.2M21](/packages/anourvalar-eloquent-serialize)[whitecube/laravel-timezones

Store UTC dates in the database and work with custom timezones in the application.

106106.2k](/packages/whitecube-laravel-timezones)[forxer/laravel-gravatar

A library providing easy gravatar integration in a Laravel project.

4235.6k](/packages/forxer-laravel-gravatar)[iteks/laravel-enum

A comprehensive Laravel package providing enhanced enum functionalities, including attribute handling, select array conversions, and fluent facade interactions for robust enum management in Laravel applications.

2516.7k](/packages/iteks-laravel-enum)[tomshaw/electricgrid

A feature-rich Livewire package designed for projects that require dynamic, interactive data tables.

116.6k](/packages/tomshaw-electricgrid)

PHPackages © 2026

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