### Installation Source: https://github.com/fgubert/memberkit-php-sdk/blob/main/README.md Instructions on how to install the MemberKit PHP SDK using Composer. ```APIDOC ## Installation Instale a biblioteca utilizando o comando `composer require fgubert/memberkit-php-sdk` ``` -------------------------------- ### Install MemberKit PHP SDK using Composer Source: https://github.com/fgubert/memberkit-php-sdk/blob/main/README.md This command installs the memberkit-php-sdk library using Composer, the dependency manager for PHP. Ensure Composer is installed on your system. ```bash composer require fgubert/memberkit-php-sdk ``` -------------------------------- ### Configuration Source: https://github.com/fgubert/memberkit-php-sdk/blob/main/README.md Example of how to include and configure the MemberKit client in your PHP project. ```APIDOC ## Configuration Para incluir a biblioteca em seu projeto, basta fazer o seguinte: ```php course($course_id); ``` ### Response #### Success Response (200) Returns the basic data of the course with its modules and lessons. ``` -------------------------------- ### lesson() - Get Lesson Details Source: https://context7.com/fgubert/memberkit-php-sdk/llms.txt Retrieves complete details for a specific lesson, including content, videos, and supplementary materials. ```APIDOC ## lesson() - Detalhes da Aula ### Description Retorna os dados completos de uma aula específica, incluindo conteúdo, vídeos e materiais complementares. ### Method GET (Assumed, based on SDK method name and purpose) ### Endpoint `/api/v1/courses/{course_id}/lessons/{lesson_id}` (Assumed, based on SDK method parameters) ### Parameters #### Path Parameters - **course_id** (integer) - Required - The ID of the course the lesson belongs to. - **lesson_id** (integer) - Required - The ID of the lesson to retrieve. ### Request Example ```php lesson($course_id, $lesson_id); ``` ### Response #### Success Response (200) - **status** (boolean) - Indicates if the request was successful. - **content** (object) - Contains the lesson details if successful. - **name** (string) - The name of the lesson. - **description** (string) - The description of the lesson. - **duration** (integer) - The duration of the lesson in minutes. - **video_url** (string) - The URL of the lesson video. #### Error Response (e.g., 404) - **status** (boolean) - False. - **code** (integer) - Error code. #### Response Example ```json { "status": true, "content": { "name": "Introdução ao PHP", "description": "Nesta aula você aprenderá os conceitos básicos", "duration": 45, "video_url": "https://memberkit.com.br/videos/abc123" } } ``` ``` -------------------------------- ### Get Lesson Details - PHP Source: https://context7.com/fgubert/memberkit-php-sdk/llms.txt Retrieves complete data for a specific lesson, including content, videos, and supplementary materials. Requires course ID and lesson ID as input. Returns status and content or an error code. ```php lesson($course_id, $lesson_id); if ($resultado['status']) { $aula = $resultado['content']; echo "Aula: " . $aula->name . "\n"; echo "Descrição: " . $aula->description . "\n"; echo "Duração: " . $aula->duration . " minutos\n"; echo "URL do Vídeo: " . $aula->video_url . "\n"; } else { echo "Aula não encontrada. Código: " . $resultado['code'] . "\n"; } // Saída esperada: // Aula: Introdução ao PHP // Descrição: Nesta aula você aprenderá os conceitos básicos // Duração: 45 minutos // URL do Vídeo: https://memberkit.com.br/videos/abc123 ?> ``` -------------------------------- ### Get Lesson Details Source: https://github.com/fgubert/memberkit-php-sdk/blob/main/README.md Retrieves complete data for a specific lesson. ```APIDOC ## Get Lesson Details ### Description Retrieves complete data for a specific lesson. ### Method GET ### Endpoint /course/{course_id}/lesson/{lesson_id} ### Query Parameters - **course_id** (string) - Required - ID of the Course. - **lesson_id** (string) - Required - ID of the Lesson. ### Request Example ```php lesson($course_id, $lesson_id); ``` ### Response #### Success Response (200) Returns the complete data for the specified lesson. ``` -------------------------------- ### Get Course Details by Course ID using MemberKit PHP SDK Source: https://github.com/fgubert/memberkit-php-sdk/blob/main/README.md This PHP code retrieves basic details of a course, including its modules and lessons. It requires the `course_id` and uses the `course` method. ```php course($course_id); ``` -------------------------------- ### Get User Activities - PHP Source: https://context7.com/fgubert/memberkit-php-sdk/llms.txt Fetches the activity feed for a specific member, detailing their platform interactions. Requires a MemberKit API key and a user's email. Returns status, content (created_at, activity_type, description), or an error code. ```php user_activities($email); if ($resultado['status']) { echo "Atividades Recentes:\n"; foreach ($resultado['content'] as $atividade) { echo "[" . $atividade->created_at . "] "; echo $atividade->activity_type . ": " . $atividade->description . "\n"; } } else { echo "Erro ao buscar atividades: " . $resultado['code'] . "\n"; } // Saída esperada: // Atividades Recentes: // [2024-01-15T10:30:00Z] lesson_completed: Completou a aula "Introdução ao PHP" // [2024-01-14T16:45:00Z] comment_posted: Comentou na aula "Variáveis e Tipos" // [2024-01-13T09:00:00Z] login: Login realizado na área de membros ?> ``` -------------------------------- ### Get Course Details - MemberKit PHP SDK Source: https://context7.com/fgubert/memberkit-php-sdk/llms.txt Retrieves basic details for a specific course, including its modules and lessons. This is useful for displaying the complete structure of a course. The response includes status, message, and content, where content is a course object containing modules and lessons. ```php course($course_id); if ($resultado['status']) { $curso = $resultado['content']; echo "Curso: " . $curso->name . "\n"; echo "Descrição: " . $curso->description . "\n\n"; echo "Módulos:\n"; foreach ($curso->modules as $modulo) { echo " - " . $modulo->name . "\n"; foreach ($modulo->lessons as $aula) { echo " Aula ID: " . $aula->id . " - " . $aula->name . "\n"; } } } else { echo "Curso não encontrado. Código: " . $resultado['code'] . "\n"; } // Saída esperada: // Curso: Curso de PHP Avançado // Descrição: Aprenda PHP do básico ao avançado // // Módulos: // - Módulo 1: Fundamentos // Aula ID: 10 - Introdução ao PHP // Aula ID: 11 - Variáveis e Tipos // - Módulo 2: POO // Aula ID: 20 - Classes e Objetos ``` -------------------------------- ### Get Specific Lesson Details using MemberKit PHP SDK Source: https://github.com/fgubert/memberkit-php-sdk/blob/main/README.md This PHP code retrieves complete details for a specific lesson within a course. It requires both `course_id` and `lesson_id` and uses the `lesson` method. ```php lesson($course_id, $lesson_id); ``` -------------------------------- ### List Classrooms - MemberKit PHP SDK Source: https://context7.com/fgubert/memberkit-php-sdk/llms.txt Retrieves all active classrooms from the MemberKit platform. Classrooms represent groups of students enrolled in specific courses, with defined start and end dates. The response includes status, message, and content, where content is an array of classroom objects. ```php classrooms(); if ($resultado['status']) { echo "Turmas ativas:\n"; foreach ($resultado['content'] as $turma) { echo "ID: " . $turma->id . " - Nome: " . $turma->name . "\n"; echo " Início: " . $turma->starts_at . " - Término: " . $turma->ends_at . "\n"; } } else { echo "Erro ao buscar turmas: " . $resultado['code'] . "\n"; } // Saída esperada: // Turmas ativas: // ID: 101 - Nome: Turma Janeiro 2024 // Início: 2024-01-15 - Término: 2024-06-15 // ID: 102 - Nome: Turma Fevereiro 2024 // Início: 2024-02-01 - Término: 2024-07-01 ``` -------------------------------- ### Get User Ranking - PHP Source: https://context7.com/fgubert/memberkit-php-sdk/llms.txt Retrieves detailed scores for a specific member, showing how points were accumulated. Requires a MemberKit API key and a user ID. Returns status, content (reason, value, created_at), and total points or an error code. ```php user_ranking($user_id); if ($resultado['status']) { echo "Pontuações do Aluno:\n"; $total = 0; foreach ($resultado['content'] as $pontuacao) { echo " - " . $pontuacao->reason . ": +" . $pontuacao->value . " pontos\n"; echo " Data: " . $pontuacao->created_at . "\n"; $total += $pontuacao->value; } echo "\nTotal: " . $total . " pontos\n"; } else { echo "Erro: " . $resultado['code'] . "\n"; } // Saída esperada: // Pontuações do Aluno: // - Conclusão do módulo 1: +100 pontos // Data: 2024-01-10T14:30:00Z // - Postagem no Instagram: +50 pontos // Data: 2024-01-12T09:15:00Z // // Total: 150 pontos ?> ``` -------------------------------- ### Initialize MemberKit PHP Client Source: https://context7.com/fgubert/memberkit-php-sdk/llms.txt Demonstrates how to initialize the MemberKit client with an API key. This is the first step before making any API calls. ```php newUser( 'João da Silva', // full_name 'joao@email.com', // email 'active', // status: active, inactive, pending false, // blocked [101, 102], // classroom_ids (IDs das turmas) false, // unlimited null, // membership_level_id null // expires_at ); if ($resultado['status'] && $resultado['code'] == 201) { echo "Aluno cadastrado com sucesso!\n"; } else { echo "Erro: " . json_encode($resultado['message']) . "\n"; } // Exemplo 2: Cadastrar aluno com acesso ilimitado $resultado = $mk->newUser( 'Maria Santos', 'maria@email.com', 'active', false, [], // classroom_ids vazio true, // unlimited = true null, null ); // Exemplo 3: Cadastrar aluno com assinatura e data de expiração $resultado = $mk->newUser( 'Pedro Oliveira', 'pedro@email.com', 'active', false, [], false, 5, // membership_level_id '31/12/2024' // expires_at (DD/MM/YYYY) ); // Exemplo 4: Bloquear um aluno existente $resultado = $mk->newUser( 'João da Silva', 'joao@email.com', 'inactive', true, // blocked = true [], false, null, null ); ?> ``` -------------------------------- ### newUser() - Create or Update User Source: https://context7.com/fgubert/memberkit-php-sdk/llms.txt Creates a new user or updates an existing user's data. Supports specific class enrollments, unlimited access, or subscriptions. ```APIDOC ## newUser() - Cadastrar ou Atualizar Aluno ### Description Cadastra um novo aluno ou atualiza os dados de um aluno existente. Suporta três modalidades de acesso: matrículas em turmas específicas, acesso ilimitado, ou assinatura. ### Method POST (Assumed, based on SDK method name and purpose) ### Endpoint `/api/v1/users` (Assumed) ### Parameters #### Request Body - **full_name** (string) - Required - The full name of the user. - **email** (string) - Required - The email address of the user. - **status** (string) - Required - The status of the user ('active', 'inactive', 'pending'). - **blocked** (boolean) - Required - Whether the user account is blocked. - **classroom_ids** (array of integers) - Optional - An array of classroom IDs the user is enrolled in. - **unlimited** (boolean) - Optional - Whether the user has unlimited access. - **membership_level_id** (integer) - Optional - The ID of the membership level. - **expires_at** (string) - Optional - The expiration date of the access (format DD/MM/YYYY). ### Request Example ```php newUser( 'João da Silva', 'joao@email.com', 'active', false, [101, 102], false, null, null ); // Exemplo 2: Cadastrar aluno com acesso ilimitado $resultado = $mk->newUser( 'Maria Santos', 'maria@email.com', 'active', false, [], true, null, null ); // Exemplo 3: Cadastrar aluno com assinatura e data de expiração $resultado = $mk->newUser( 'Pedro Oliveira', 'pedro@email.com', 'active', false, [], false, 5, '31/12/2024' ); // Exemplo 4: Bloquear um aluno existente $resultado = $mk->newUser( 'João da Silva', 'joao@email.com', 'inactive', true, [], false, null, null ); ``` ### Response #### Success Response (201 for creation, 200 for update) - **status** (boolean) - Indicates if the request was successful. - **code** (integer) - HTTP status code (e.g., 201 for created, 200 for updated). - **message** (string) - Confirmation message. #### Error Response - **status** (boolean) - False. - **message** (string) - Error details. - **code** (integer) - Error code. #### Response Example ```json { "status": true, "code": 201, "message": "Aluno cadastrado com sucesso!" } ``` ``` -------------------------------- ### Create or Update Student with MemberKit PHP SDK Source: https://github.com/fgubert/memberkit-php-sdk/blob/main/README.md This function allows you to register a new student or update an existing one in MemberKit. You must specify one access modality: individual classrooms, unlimited access, or a membership level. It takes student details like name, email, status, and access parameters as input. ```php newUser($full_name, $email, $status='active', $blocked=false, $classroom_ids=array(), $unlimited=false, $membership_level_id=null, $expires_at=null); ?> ``` -------------------------------- ### List Active Classrooms using MemberKit PHP SDK Source: https://github.com/fgubert/memberkit-php-sdk/blob/main/README.md This PHP code retrieves a list of all active classrooms from the MemberKit API using the initialized client. It calls the `classrooms` method. ```php classrooms(); ``` -------------------------------- ### List All Registered Courses using MemberKit PHP SDK Source: https://github.com/fgubert/memberkit-php-sdk/blob/main/README.md This PHP code retrieves a list of all courses registered in the MemberKit system. It uses the `courses` method of the client. ```php courses(); ``` -------------------------------- ### List Courses Source: https://github.com/fgubert/memberkit-php-sdk/blob/main/README.md Lists all registered courses. ```APIDOC ## List Courses ### Description Lists all registered courses. ### Method GET ### Endpoint /courses ### Request Example ```php courses(); ``` ### Response #### Success Response (200) Returns a list of all registered courses. ``` -------------------------------- ### POST /users Source: https://github.com/fgubert/memberkit-php-sdk/blob/main/README.md Registers or updates a student in the Memberkit platform. Supports individual, unlimited, or membership-based access levels. ```APIDOC ## POST /users ### Description Registers or updates a student. Use one of the access modalities: classroom_ids, unlimited, or membership_level_id. ### Method POST ### Parameters #### Request Body - **full_name** (string) - Required - Full name of the student - **email** (string) - Required - Email address of the student - **status** (string) - Optional - 'inactive', 'pending', or 'active' - **blocked** (boolean) - Optional - Global access block status - **classroom_ids** (string) - Optional - Comma-separated list of classroom IDs - **unlimited** (boolean) - Optional - Unlimited access flag - **membership_level_id** (integer) - Optional - Subscription code - **expires_at** (string) - Optional - Expiration date (DD/MM/YYYY) ### Request Example $mk->newUser('John Doe', 'john@example.com', 'active', false, array(1, 2), false, null, null); ``` -------------------------------- ### Create or Update Student Source: https://github.com/fgubert/memberkit-php-sdk/blob/main/README.md Creates or updates a student record. ```APIDOC ## Create or Update Student ### Description Creates or updates a student record. ### Method POST ### Endpoint /student ### Request Body - **student_data** (object) - Required - Data for the student. ### Request Example ```php 'John Doe', 'email' => 'john.doe@example.com', 'custom_fields' => [ 'field_name' => 'value' ] ]; $mk->create_or_update_student($student_data); ``` ### Response #### Success Response (200) Indicates successful creation or update of the student record. ``` -------------------------------- ### List Courses - MemberKit PHP SDK Source: https://context7.com/fgubert/memberkit-php-sdk/llms.txt Lists all courses registered on the MemberKit platform. This function supports pagination via an optional page parameter, allowing retrieval of courses across multiple pages. The response contains status, message, and content, where content is an array of course objects. ```php courses(); if ($resultado['status']) { echo "Cursos cadastrados:\n"; foreach ($resultado['content'] as $curso) { echo "ID: " . $curso->id . " - " . $curso->name . "\n"; } } // Listar cursos com paginação (página 2) $resultado_pagina2 = $mk->courses(2); if ($resultado_pagina2['status']) { echo "\nCursos na página 2:\n"; foreach ($resultado_pagina2['content'] as $curso) { echo "ID: " . $curso->id . " - " . $curso->name . "\n"; } } // Saída esperada: // Cursos cadastrados: // ID: 1 - Curso de PHP Avançado // ID: 2 - Curso de Laravel // ID: 3 - Curso de APIs REST ``` -------------------------------- ### token() - Generate Authentication Token Source: https://context7.com/fgubert/memberkit-php-sdk/llms.txt Generates a temporary authentication token (valid for 1 hour) for a user. Useful for implementing automatic login or SSO. ```APIDOC ## token() - Gerar Token de Autenticação ### Description Gera um novo token de autenticação temporário (duração de 1 hora) para um aluno. Útil para implementar login automático ou SSO (Single Sign-On). ### Method POST (Assumed, based on SDK method name and purpose) ### Endpoint `/api/v1/auth/token` (Assumed) ### Parameters #### Request Body - **email** (string) - Required - The email address of the user for whom to generate the token. ### Request Example ```php token($email); ``` ### Response #### Success Response (200) - **status** (boolean) - Indicates if the request was successful. - **content** (object) - Contains the token details if successful. - **auth_token** (string) - The generated authentication token. - **expires_at** (string) - The expiration date and time of the token (ISO 8601 format). #### Error Response - **status** (boolean) - False. - **code** (integer) - Error code. #### Response Example ```json { "status": true, "content": { "auth_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", "expires_at": "2024-01-15T16:30:00Z" } } ``` ``` -------------------------------- ### Mark Course Lessons as Incomplete Source: https://github.com/fgubert/memberkit-php-sdk/blob/main/README.md Marks all lessons in a course as not completed. ```APIDOC ## Mark Course Lessons as Incomplete ### Description Marks all lessons in a course as not completed. ### Method POST ### Endpoint /course/reset_lessons ### Request Body - **course_id** (string) - Required - The ID of the course. ### Request Example ```php reset_course_lessons($course_id); ``` ### Response #### Success Response (200) Indicates that all lessons in the course have been marked as not completed. ``` -------------------------------- ### Generate Authentication Token using MemberKit PHP SDK Source: https://github.com/fgubert/memberkit-php-sdk/blob/main/README.md This PHP code generates a new authentication token with a 1-hour duration for a given member. It requires the member's email address and uses the `token` method. ```php token($email); ``` -------------------------------- ### Mark All Course Lessons as Incomplete with MemberKit PHP SDK Source: https://github.com/fgubert/memberkit-php-sdk/blob/main/README.md This function resets the progress for all lessons within a specific course, marking them as incomplete for a given student. It requires the student's email and the course ID. This is useful for scenarios where a student needs to retake a course or reset their progress. ```php delete_lesson_statuses($user_email, $course_id); ?> ``` -------------------------------- ### Generate Auth Token Source: https://github.com/fgubert/memberkit-php-sdk/blob/main/README.md Generates a new authentication token with a 1-hour duration. ```APIDOC ## Generate Auth Token ### Description Generates a new authentication token with a 1-hour duration. ### Method POST ### Endpoint /token ### Query Parameters - **email** (string) - Required - The student's email address. ### Request Example ```php token($email); ``` ### Response #### Success Response (200) Returns a new authentication token. ``` -------------------------------- ### Reset Course Progress - PHP Source: https://context7.com/fgubert/memberkit-php-sdk/llms.txt Resets a student's progress for a specific course, marking all lessons as incomplete. Useful for allowing students to retake a course. Requires API key, user email, and course ID. Returns status or an error message. ```php delete_lesson_statuses( 'joao@email.com', // user_email 1 // course_id ); if ($resultado['status']) { echo "Progresso do curso resetado com sucesso!\n"; echo "Aluno: joao@email.com\n"; echo "Todas as aulas foram marcadas como não concluídas.\n"; } else { echo "Erro ao resetar progresso: " . json_encode($resultado['message']) . "\n"; } // Exemplo: Resetar progresso de múltiplos alunos $alunos = ['joao@email.com', 'maria@email.com', 'pedro@email.com']; $course_id = 1; foreach ($alunos as $email) { $resultado = $mk->delete_lesson_statuses($email, $course_id); if ($resultado['status']) { echo "Resetado: $email\n"; } } ?> ``` -------------------------------- ### List Rankings by Classroom ID using MemberKit PHP SDK Source: https://github.com/fgubert/memberkit-php-sdk/blob/main/README.md This PHP code retrieves the ranking of members within a specific classroom. It requires the `classroom_id` as a parameter and uses the `rankings` method. ```php rankings($classrom_id); ``` -------------------------------- ### rankings() - List Rankings Source: https://context7.com/fgubert/memberkit-php-sdk/llms.txt Lists all members and their accumulated scores in the platform's gamification/ranking system. ```APIDOC ## rankings() - Listar Rankings ### Description Lista todos os membros e suas respectivas pontuações acumuladas no sistema de gamificação/ranking da plataforma. ### Method GET (Assumed, based on SDK method name and purpose) ### Endpoint `/api/v1/rankings` (Assumed) ### Parameters None ### Request Example ```php rankings(); ``` ### Response #### Success Response (200) - **status** (boolean) - Indicates if the request was successful. - **content** (array of objects) - A list of members and their scores. - **user_name** (string) - The username of the member. - **total_points** (integer) - The total accumulated points. #### Error Response - **status** (boolean) - False. - **code** (integer) - Error code. #### Response Example ```json { "status": true, "content": [ { "user_name": "Maria Santos", "total_points": 1250 }, { "user_name": "João da Silva", "total_points": 980 }, { "user_name": "Pedro Oliveira", "total_points": 875 } ] } ``` ``` -------------------------------- ### List Member Activities by Email using MemberKit PHP SDK Source: https://github.com/fgubert/memberkit-php-sdk/blob/main/README.md This PHP code retrieves the activity feed for a specific member. It requires the member's email address and uses the `user_activities` method. ```php user_activities($email); ``` -------------------------------- ### List Active Memberships using MemberKit PHP SDK Source: https://github.com/fgubert/memberkit-php-sdk/blob/main/README.md This PHP code retrieves a list of all active memberships from the MemberKit API using the initialized client. It calls the `membership_levels` method. ```php membership_levels(); ``` -------------------------------- ### List Rankings - PHP Source: https://context7.com/fgubert/memberkit-php-sdk/llms.txt Retrieves a list of all members and their accumulated scores in the platform's gamification/ranking system. Returns status and a list of members with their names and total points, or an error code. ```php rankings(); if ($resultado['status']) { echo "Ranking Geral:\n"; echo str_repeat("-", 40) . "\n"; $posicao = 1; foreach ($resultado['content'] as $membro) { echo $posicao . "º - " . $membro->user_name . ": " . $membro->total_points . " pontos\n"; $posicao++; } } else { echo "Erro ao buscar ranking: " . $resultado['code'] . "\n"; } // Saída esperada: // Ranking Geral: // ---------------------------------------- // 1º - Maria Santos: 1250 pontos // 2º - João da Silva: 980 pontos // 3º - Pedro Oliveira: 875 pontos ?> ``` -------------------------------- ### List Membership Levels - MemberKit PHP SDK Source: https://context7.com/fgubert/memberkit-php-sdk/llms.txt This function retrieves all active membership levels (access levels) from the MemberKit platform. It's useful for obtaining membership IDs needed for registering new students. The output includes status, message, and content, where content is an array of membership objects. ```php membership_levels(); if ($resultado['status']) { echo "Assinaturas encontradas:\n"; foreach ($resultado['content'] as $assinatura) { echo "ID: " . $assinatura->id . " - Nome: " . $assinatura->name . "\n"; } } else { echo "Erro: " . $resultado['message'] . " (Código: " . $resultado['code'] . ")\n"; } // Saída esperada: // Assinaturas encontradas: // ID: 1 - Nome: Plano Básico // ID: 2 - Nome: Plano Premium // ID: 3 - Nome: Plano VIP ``` -------------------------------- ### Generate Authentication Token - PHP Source: https://context7.com/fgubert/memberkit-php-sdk/llms.txt Generates a temporary authentication token (valid for 1 hour) for a user. Useful for implementing automatic login or SSO. Requires the user's email. Returns the authentication token and its expiration time, or an error code. ```php token($email); if ($resultado['status']) { $token = $resultado['content']; echo "Token gerado com sucesso!\n"; echo "Token: " . $token->auth_token . "\n"; echo "Expira em: " . $token->expires_at . "\n"; // URL de login automático $login_url = "https://suaarea.memberkit.com.br/auth?token=" . $token->auth_token; echo "URL de Login: " . $login_url . "\n"; } else { echo "Erro ao gerar token: " . $resultado['code'] . "\n"; } // Saída esperada: // Token gerado com sucesso! // Token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9... // Expira em: 2024-01-15T16:30:00Z // URL de Login: https://suaarea.memberkit.com.br/auth?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9... ?> ``` -------------------------------- ### Add Score to Student with MemberKit PHP SDK Source: https://github.com/fgubert/memberkit-php-sdk/blob/main/README.md This function enables the manual addition of points to a student's ranking within a specific course. It requires the student's email, a reason for the score, the value of the points, and the course ID. This is useful for rewarding specific student actions. ```php scores($user_email, $reason, $value, $course_id); ?> ``` -------------------------------- ### List Member Activity Feeds Source: https://github.com/fgubert/memberkit-php-sdk/blob/main/README.md Lists activity feeds for a specific member. ```APIDOC ## List Member Activity Feeds ### Description Lists activity feeds for a specific member. ### Method GET ### Endpoint /user_activities ### Query Parameters - **email** (string) - Required - The student's email address. ### Request Example ```php user_activities($email); ``` ### Response #### Success Response (200) Returns the activity feeds for the specified member. ``` -------------------------------- ### List Active Classrooms Source: https://github.com/fgubert/memberkit-php-sdk/blob/main/README.md Retrieves a list of all active classrooms in the member area. ```APIDOC ## List Active Classrooms ### Description Lists all active classrooms in the member area. ### Method GET ### Endpoint /classrooms ### Request Example ```php classrooms(); ``` ### Response #### Success Response (200) Returns a list of active classrooms. ``` -------------------------------- ### List Members and Rankings Source: https://github.com/fgubert/memberkit-php-sdk/blob/main/README.md Lists members and their accumulated scores in the ranking. ```APIDOC ## List Members and Rankings ### Description Lists members and their accumulated scores in the ranking. ### Method GET ### Endpoint /rankings ### Query Parameters - **classroom_id** (string) - Required - ID of the Classroom. ### Request Example ```php rankings($classrom_id); ``` ### Response #### Success Response (200) Returns a list of members and their ranking scores. ``` -------------------------------- ### List User Ranking by User ID using MemberKit PHP SDK Source: https://github.com/fgubert/memberkit-php-sdk/blob/main/README.md This PHP code retrieves the accumulated scores for a specific member. It requires the `user_id` of the student and uses the `user_ranking` method. ```php user_ranking($user_id); ``` -------------------------------- ### POST /scores Source: https://github.com/fgubert/memberkit-php-sdk/blob/main/README.md Adds a manual score to a student's ranking. ```APIDOC ## POST /scores ### Description Manually adds points to a student's ranking for a specific course. ### Method POST ### Parameters #### Request Body - **user_email** (string) - Required - Email of the student - **reason** (string) - Required - Reason for the score - **value** (integer) - Required - Points to add - **course_id** (integer) - Required - ID of the course ### Request Example $mk->scores('john@example.com', 'Instagram post', 10, 123); ``` -------------------------------- ### DELETE /lesson_statuses Source: https://github.com/fgubert/memberkit-php-sdk/blob/main/README.md Resets all lesson completion statuses for a specific course. ```APIDOC ## DELETE /lesson_statuses ### Description Marks all lessons of a specific course as uncompleted for a given student. ### Method DELETE ### Parameters #### Request Body - **user_email** (string) - Required - Email of the student - **course_id** (integer) - Required - ID of the course ### Request Example $mk->delete_lesson_statuses('john@example.com', 123); ``` -------------------------------- ### Add Score - PHP Source: https://context7.com/fgubert/memberkit-php-sdk/llms.txt Manually adds a new score to a student's ranking, useful for gamification. Requires API key, user email, reason for the score, point value, and course ID. Returns status and a 201 code on success or an error message. ```php scores( 'joao@email.com', // user_email 'Postagem no Instagram', // reason 50, // value (pontos) 1 // course_id ); if ($resultado['status'] && $resultado['code'] == 201) { echo "Pontuação adicionada com sucesso!\n"; echo "Aluno: joao@email.com\n"; echo "Motivo: Postagem no Instagram\n"; echo "Pontos: +50\n"; } else { echo "Erro ao adicionar pontuação: " . json_encode($resultado['message']) . "\n"; } // Exemplo: Adicionar múltiplas pontuações $pontuacoes = [ ['email' => 'maria@email.com', 'reason' => 'Indicou um amigo', 'value' => 100], ['email' => 'pedro@email.com', 'reason' => 'Completou desafio semanal', 'value' => 75], ]; foreach ($pontuacoes as $p) { $mk->scores($p['email'], $p['reason'], $p['value'], 1); } ?> ``` -------------------------------- ### List Active Memberships Source: https://github.com/fgubert/memberkit-php-sdk/blob/main/README.md Retrieves a list of all active memberships in the member area. ```APIDOC ## List Active Memberships ### Description Lists all active subscriptions in the member area. ### Method GET ### Endpoint /memberships ### Request Example ```php membership_levels(); ``` ### Response #### Success Response (200) Returns a list of active memberships. ``` -------------------------------- ### List Member Scores Source: https://github.com/fgubert/memberkit-php-sdk/blob/main/README.md Lists the scores of a specific member. ```APIDOC ## List Member Scores ### Description Lists the scores of a specific member. ### Method GET ### Endpoint /user_ranking ### Query Parameters - **user_id** (string) - Required - ID of the Student User. ### Request Example ```php user_ranking($user_id); ``` ### Response #### Success Response (200) Returns the scores for the specified member. ``` -------------------------------- ### Add Score Source: https://github.com/fgubert/memberkit-php-sdk/blob/main/README.md Adds a new score for a member. ```APIDOC ## Add Score ### Description Adds a new score for a member. ### Method POST ### Endpoint /score ### Request Body - **user_id** (string) - Required - The ID of the user. - **score** (integer) - Required - The score to add. - **reason** (string) - Optional - The reason for adding the score. ### Request Example ```php add_score($user_id, 100, 'Completed a task'); ``` ### Response #### Success Response (200) Indicates the score was successfully added. ``` -------------------------------- ### Remove Score from Student with MemberKit PHP SDK Source: https://github.com/fgubert/memberkit-php-sdk/blob/main/README.md This function allows for the removal of a manually added score from a student's ranking. To remove the score, you must provide the same 'reason' that was used when the score was initially added, along with the student's email and the course ID. This ensures accurate score management. ```php delete_scores($user_email, $reason, $course_id); ?> ``` -------------------------------- ### DELETE /scores Source: https://github.com/fgubert/memberkit-php-sdk/blob/main/README.md Removes a manually added score from a student's ranking. ```APIDOC ## DELETE /scores ### Description Removes a previously added manual score. The 'reason' must match the original entry. ### Method DELETE ### Parameters #### Request Body - **user_email** (string) - Required - Email of the student - **reason** (string) - Required - The original reason used for the score - **course_id** (integer) - Required - ID of the course ### Request Example $mk->delete_scores('john@example.com', 'Instagram post', 123); ``` -------------------------------- ### Delete Score - PHP Source: https://context7.com/fgubert/memberkit-php-sdk/llms.txt Removes a manually added score. The 'reason' must exactly match the one used during score addition. Requires API key, user email, the exact reason, and course ID. Returns status or an error message. ```php delete_scores( 'joao@email.com', // user_email 'Postagem no Instagram', // reason (deve ser idêntico ao da adição) 1 // course_id ); if ($resultado['status']) { echo "Pontuação removida com sucesso!\n"; } else { echo "Erro ao remover pontuação: " . json_encode($resultado['message']) . "\n"; echo "Verifique se o motivo está escrito exatamente igual ao usado na adição.\n"; } // Saída esperada: // Pontuação removida com sucesso! ?> ``` -------------------------------- ### Remove Score Source: https://github.com/fgubert/memberkit-php-sdk/blob/main/README.md Removes a manually added score. ```APIDOC ## Remove Score ### Description Removes a manually added score. ### Method DELETE ### Endpoint /score ### Request Body - **user_id** (string) - Required - The ID of the user. - **score_id** (string) - Required - The ID of the score to remove. ### Request Example ```php remove_score($user_id, $score_id); ``` ### Response #### Success Response (200) Indicates the score was successfully removed. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.