Coder Social home page Coder Social logo

api-response's Introduction

Hi there ๐Ÿ‘‹ , I'm

Obay Adam

Software Developer

  • ๐Ÿคฏ I'm currently dedicating my time and energy to mastering JavaScript.

  • ๐Ÿ’ฌ Ask me about PHP, Laravel, Vue.js, React, Next.js, SQL, Software Engineering

Languages and Tools I've Used

My GitHub Stats and Streak

GitHub stats

api-response's People

Contributors

ashish-patidar-rau avatar beauraines avatar boudydegeer avatar dependabot[bot] avatar kevinruscoe avatar khatabwedaa avatar mdhesari avatar obiefy avatar ramnzys avatar samyoteroglez avatar seifodev avatar sunxyw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

api-response's Issues

PHP 8 Compatibility

Hello developer, I'm using your excellent package, but I have a issue with php 8 version, can you update your package to fix this problem?.

This is composer console error:

Problem 1
- Root composer.json requires obiefy/api-response ^0.9.5 -> satisfiable by obiefy/api-response[v0.9.5].
- obiefy/api-response v0.9.5 requires php ^7.3 -> your php version (8.0.5) does not satisfy that requirement.

Thanks!!

Type cast DATACONT to string

if the config('api.stringify') is set to true response will be like:

{
    "STATUS": "200",
    "MESSAGE": "User Profile data",
    "DATA": [
        ...
    ],
    "DATACOUNT": 6
}

The expected response is:

{
    "STATUS": "200",
    "MESSAGE": "User Profile data",
    "DATA": [
        ...
    ],
    "DATACOUNT": "6"
}

@beauraines can you please submit PR for this one?

Implement Macros

Good for high-level configuration,
So the developer just configures new methods by just adding it to config files.
like:

'methods' => [
        [
            'code' => 444,
            'method' => 'forbidden',
            'message' => 'This is default message'
        ]
    ]

After that developer can access this throw helpers or facades
api()->forbidden()

Installation Error - Laravel 10.10

Hi! I get this error when installing version 0.9.7

Problem 1
- Root composer.json requires obiefy/api-response ^0.9.7 -> satisfiable by obiefy/api-response[v0.9.7].
- obiefy/api-response v0.9.7 requires illuminate/support ^8.0|^7.0|^6.0|^5.5 -> found illuminate/support[v5.5.0, ..., v5.8.36, v6.0.0, ..., v6.20.44, v7.0.0, ..., v7.30.6, v8.0.0, ..., v8.83.27] but these were not loaded, likely because it conflicts with another require.
You can also try re-running composer require with an explicit version constraint, e.g. "composer require obiefy/api-response:*" to figure out if any version is installable, or "composer require obiefy/api-response:^2.1" if you know which you need.

Not compatible with Laravel10?

Installation Issue

I am having

Problem 1
   - Installation request for obiefy/api-response ^0.9.1 -> satisfiable by obiefy/api-response[v0.9.1].
   - Installation request for laravel/framework (locked at v8.10.0, required as ^8.0) -> satisfiable by laravel/framework[v8.10.0].
   - Can only install one of: laravel/framework[8.x-dev, 5.7.x-dev].
   - Can only install one of: laravel/framework[v8.0.0, 5.7.x-dev].
   - Can only install one of: laravel/framework[v8.0.1, 5.7.x-dev].
   - Can only install one of: laravel/framework[v8.0.2, 5.7.x-dev].
   - Can only install one of: laravel/framework[v8.0.3, 5.7.x-dev].
   - Can only install one of: laravel/framework[v8.0.4, 5.7.x-dev].
   - Can only install one of: laravel/framework[v8.1.0, 5.7.x-dev].
   - Can only install one of: laravel/framework[v8.10.0, 5.7.x-dev].
   - Can only install one of: laravel/framework[v8.2.0, 5.7.x-dev].
   - Can only install one of: laravel/framework[v8.3.0, 5.7.x-dev].
   - Can only install one of: laravel/framework[v8.4.0, 5.7.x-dev].
   - Can only install one of: laravel/framework[v8.5.0, 5.7.x-dev].
   - Can only install one of: laravel/framework[v8.6.0, 5.7.x-dev].
   - Can only install one of: laravel/framework[v8.7.0, 5.7.x-dev].
   - Can only install one of: laravel/framework[v8.7.1, 5.7.x-dev].
   - Can only install one of: laravel/framework[v8.8.0, 5.7.x-dev].
   - Can only install one of: laravel/framework[v8.9.0, 5.7.x-dev].
   - Can only install one of: laravel/framework[5.7.x-dev, v8.10.0].
   - Can only install one of: laravel/framework[5.7.x-dev, v8.10.0].
   - Conclusion: install laravel/framework 5.7.x-dev
   - Installation request for laravel/framework ^8.0 -> satisfiable by laravel/framework[8.x-dev, v8.0.0, v8.0.1, v8.0.2, v8.0.3, v8.0.4, v8.1.0, v8.10.0, v8.2.0, v8.3.0, v8.4.0, v8.5.0, v8.6.0, v8.7.0, v8.7.1, v8.8.0, v8.9.0].

How can I fix it?

Compatibility with Laravel 8

I am trying to install it on Laravel 8.6 but i get:

Problem 1
- Installation request for obiefy/api-response ^0.9.1 -> satisfiable by obiefy/api-response[v0.9.1].
- Conclusion: remove laravel/framework v8.6.0
- Conclusion: don't install laravel/framework v8.6.0

Any idea if this a compatibility issue with the latest Laravel 8?

The API response doesn't set the http status header

It seems that all of your API responses return a 200 OK http status header.

This means that any receiving front-end framework will receive conflicting status information in the event of a non-200 status (JSON object says "500 Internal Server Error", http header says "200 OK") and front-end libraries may fail to detect errors as the status header tells them everything's OK, even if the server has thrown an error.

Screenshot 2019-09-30 at 17 21 40

Support JSON API specification

It would be good if you could support and promote use of the JSON API specification, which is already an established format:

HTTP/1.1 422 Unprocesssable Entity
Content-Type: application/vnd.api+json

{
  "errors": [
    {
      "source": { "pointer": "" },
      "detail":  "Missing `data` Member at document's top level."
    }
  ]
}

https://jsonapi.org/examples/

Update API docs

  • Move documentation to another website.
  • Integrate with documentation platform.
  • create real time simulation app to generate config file.

Add ability to make response parameters flexible

I thinking about something like this.

api()->response($status, $message, $data, $extraData);

at the current version this will not work, because response() method parameters are fixed to three (status, message and data).

Class 'Obiefy\API\API ServiceProvider' not found

i follow all steps to installation and setting up. finally step 4; I run the command
php artisan vendor:publish --tag=api-response
it give me error :

In ProviderRepository.php line 208:
  Class 'Obiefy\API\APIServiceProvider' not found

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.