Introduction
About this book
- Who is this book for?
- How to use this book
- What are we building?
Requirements
- Composer
- Git
Package setup
- Project structure
- Composer init
- Composer require-dev
- Composer require
Laravel Packages
- Service Provider
- Facades
Testing
- Why Test-Driven Approach?
- Setup tests
- Conversation
- Composer Scripts
- It returns a conversation
- Model Factories - generate test data
- It can add participants to a conversation
- It can remove a single participant from a conversation
- It can return conversation participants
- It can create a direct conversation between two participants
- It can make a private conversation
- It can create a conversation with details
- Value Objects - gain control over primitives
- Refactoring Tests
- Messaging
Create messages
- It can send a message
- It can specify the message type
- It returns a message given the id
- It creates participant message references
Read / Delete messages
- It can mark a message as read
- It can tell whether a participating model has read a message
- It can mark a conversation as read
- Events
What are events?
Our package events
- ConversationStarted
- ParticipantsJoined
- ParticipantsLeft
- MessageWasSent
- Routes in packages
Unit tests vs Feature tests
Conversation
- POST /conversations
- GET /conversations/<id>
- PUT /conversations/<id>
Participation
- POST /conversations/<id>/participants
- DELETE /conversations/<id>/participants
- GET /conversations/<id>/participants
Messaging
- POST /conversations/<id>/messages
- GET /conversations/<id>/messages
- Configuration
- Data Transformers
What are transformers
Fractal
Conversation Transformer
- GET /conversations/<id>
- POST /conversations
Message Transformer
- POST /conversations/<id>/messages
- GET /conversations/<id>/messages
- Continuous Integration
What is Continuous Integration?
Travis CI
- Package distribution