PHPackages                             mexzziv/pet-api - 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. mexzziv/pet-api

ActiveProject

mexzziv/pet-api
===============

API like a OpenAPI-Specification

00PHP

Since Apr 30Pushed 5y ago1 watchersCompare

[ Source](https://github.com/mexzziv/pet)[ Packagist](https://packagist.org/packages/mexzziv/pet-api)[ RSS](/packages/mexzziv-pet-api/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

### Proyecto

[](#proyecto)

La API esta desarrollada en Laravel en su versión 7x, utilizando MySQL como gestor de Base de Datos.

Para su instalación puede clonar el repositorio en  o con el comando

```
composer required mexzziv/pet-api

```

Cuando termine la imputación modifica el nombre del archivo .env.example a .env para que el proyecto detecte las variables de entorno.

Una vez cambiado el nombre del .env ejecutar el siguiente comando para generar la llave de Encriptado

```
php artisan key:generate

```

### Inicializar proyecto

[](#inicializar-proyecto)

Para la integración de tu base de datos modifica el archivo .env en las siguientes lineas:

```
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=

```

Crear la tabla en la base de datos con el siguiente comando

```
php artisan migrate
```

Ejecutar el seeder para el llenado de la base de datos

```
php artisan db:seed --class=PetSeeder
```

Si se desea modificar los datos a llenar ingresa al archivo database/seeds/PetSeeder.php

```
class PetSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
      ...
    }
}
```

### Gestión de la API

[](#gestión-de-la-api)

Existes 3 rutas las cuales son:

```
v1/pets/
v1/pets/create
v1/pets/{id}

```

##### GET -&gt; v1/pets/

[](#get---v1pets)

La ruta devuelve los registros de la Base de datos limitados a 100 registros

Vista de respuesta

```
[
  {
    "id": 1,
    "name": "kFIu4",
    "tag": "dF5Vf"
  },
  {
    "id": 2,
    "name": "aPY3I",
    "tag": "fEWAH"
  },
  {
    "id": 3,
    "name": "36bwx",
    "tag": "Mo9dC"
  },
  {
    "id": 4,
    "name": "vEXzK",
    "tag": "xHpca"
  },
  {
    "id": 5,
    "name": "BSyBl",
    "tag": "eSodR"
  },
  {
    "id": 6,
    "name": "t6JWu",
    "tag": "iLFFh"
  },
  {
    "id": 7,
    "name": "Rl2Wp",
    "tag": "4ClMK"
  },
  {
    "id": 8,
    "name": "at8JK",
    "tag": "UJUVW"
  },
  {
    "id": 9,
    "name": "DLQmn",
    "tag": "z4NO5"
  },
  {
    "id": 10,
    "name": "SlXvq",
    "tag": "RzvBW"
  },
  {
    "id": 11,
    "name": "ytnVK",
    "tag": "cww9Y"
  },
  {
    "id": 12,
    "name": "Firus",
    "tag": "Perro"
  },
  {
    "id": 13,
    "name": "Don Gato",
    "tag": "Gato"
  },
  {
    "id": 14,
    "name": "Cerebro",
    "tag": "Raton"
  },
  {
    "id": 15,
    "name": "Piolin",
    "tag": "Canario"
  },
  {
    "id": 16,
    "name": "Dino",
    "tag": "Dinosuario"
  }
]
```

##### POST -&gt; v1/pets/

[](#post---v1pets)

El enponit realizar el registro en la base de datos necesita como parametro el name dentro de la peticion POST, si el registro es exitoso da el siguiente resultado:

```
{
    "code": 200,
    "status": "Create a pet",
    "response": {
        "name": "Mono",
        "tag": "pets",
        "updated_at": "2021-04-30T18:49:17.000000Z",
        "created_at": "2021-04-30T18:49:17.000000Z",
        "id": 17
    }
}

```

Si dentro de petición hace falta el parámetro name dará como respuesta el siguiente mensaje

```
{
  "code": 2,
  "status": "Validated fail",
  "response": {
    "name": ["The name field is required."]
  }
}
```

Si ocurre un durante el proceso se manda el siguiente mensaje

```
{
  "code": 3,
  "status": "error",
  "response": null
}
```

##### GET -&gt; v1/pets/{id}

[](#get---v1petsid)

El endpoint para la búsqueda de un registro para el id solo necesita como parámetro el id a buscar, dando como resultado el siguiente mensaje si hubo una coincidencia:

```
{
  "code": 200,
  "status": "Pet find by id: 3",
  "response": {
    "id": 3,
    "name": "36bwx",
    "tag": "Mo9dC",
    "created_at": null,
    "updated_at": null
  }
}
```

Si la búsqueda no da un resultado dará el siguiente mensaje:

```
{
  "code": 404,
  "status": "Pet not found",
  "response": null
}
```

### Postman

[](#postman)

Para hacer pruebas de los endpoints se puede utilizar el siguiente codigo

```
{
	"info": {
		"_postman_id": "e410fa68-8a50-4482-be07-a0116e40086f",
		"name": "Pets API",
		"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
	},
	"item": [
		{
			"name": "http://tu_url_va_aqui/api/v1/pets/{id}",
			"request": {
				"method": "GET",
				"header": [],
				"url": {
					"raw": "http://tu_url_va_aqui/api/v1/pets/{id}",
					"protocol": "http",
					"host": [
						"develop",
						"aktivamas",
						"com"
					],
					"path": [
						"api",
						"v1",
						"pets",
						"3"
					]
				},
				"description": "Get pet by ID"
			},
			"response": []
		},
		{
			"name": "http://tu_url_va_aqui/api/v1/pets",
			"request": {
				"method": "GET",
				"header": [],
				"url": {
					"raw": "http://tu_url_va_aqui/api/v1/pets",
					"protocol": "http",
					"host": [
						"develop",
						"aktivamas",
						"com"
					],
					"path": [
						"api",
						"v1",
						"pets"
					]
				},
				"description": "Get all pets"
			},
			"response": []
		},
		{
			"name": "http://tu_url_va_aqui/api/v1/pets/create?name=Mono",
			"request": {
				"method": "POST",
				"header": [],
				"url": {
					"raw": "http://tu_url_va_aqui/api/v1/pets/create?name=Mono",
					"protocol": "http",
					"host": [
						"develop",
						"aktivamas",
						"com"
					],
					"path": [
						"api",
						"v1",
						"pets",
						"create"
					],
					"query": [
						{
							"key": "name",
							"value": "Mono"
						}
					]
				},
				"description": "Create pet in a API"
			},
			"response": []
		}
	]
}

```

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity30

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/841689bb98b86a5c3cc1181776165b78f9af1a150e5cb4edd4a7ef73c8ec9045?d=identicon)[mexzziv](/maintainers/mexzziv)

---

Top Contributors

[![mexzziv](https://avatars.githubusercontent.com/u/8380391?v=4)](https://github.com/mexzziv "mexzziv (10 commits)")

### Embed Badge

![Health badge](/badges/mexzziv-pet-api/health.svg)

```
[![Health](https://phpackages.com/badges/mexzziv-pet-api/health.svg)](https://phpackages.com/packages/mexzziv-pet-api)
```

PHPackages © 2026

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