Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Laravel with Aspect Oriented Architecture

Laravel with Aspect Oriented Architecture

yuuki takezawa

June 17, 2016
Tweet

More Decks by yuuki takezawa

Other Decks in Technology

Transcript

  1. ϓϩάϥϜ͸Ͳ͏͋Δ΂͖͔ʁ • ίϯϙʔωϯτΛϕʔεʹγεςϜΛߏங͍ͯ͘͠Ұൠ తͳύλʔϯ • ΫϥεɺύοέʔδɺαʔϏεͳͲͷίϯϙʔωϯτʹ
 ཁٻΛׂΓ౰ͯͯߟ͑Δ • େମͷύλʔϯͰ͸ޮՌతʹίϯϙʔωϯτͱͯ͠࡞༻ •

    ޮՌతͰ͸ͳ͍ύλʔϯͱ͸ɺଞͷίϯϙʔωϯτʹ ӨڹΛ༩͑ͯ͠·͏΋ͷ͕෼཭Ͱ͖ͳ͍ύλʔϯͰ͋Γɺ ͜Ε͸େ͖ͳΞϓϦέʔγϣϯʹͳΕ͹ͳΔ΄Ͳ໰୊ ͱͳΓ·͢ɻ
  2. /** * @param $id * * @return mixed * @throws

    \Exception */ public function makeReservation($id) { if ($this->reserve->getQuantity($id)) { return $this->reserve->createReservation($id); } throw new \NoRoomException(); }
  3. /** * @param $id * @WaitingList * @return mixed *

    @throws \Exception */ public function makeReservation($id) { if ($this->reserve->getQuantity($id)) { return $this->reserve->createReservation($id); } throw new \NoRoomException(); }
  4. // contextual bind͔Ͳ͏͔ if (isset($this->app->contextual[$class])) { // $this->resolveContextualBindings($class, $compiledClass); }

    // ίϯύΠϧͨ͠Ϋϥε΁ͱೖΕସ͑Δ $this->app->bind($class, function ($app) use ($bind, $compiledClass) { $instance = $app->make($compiledClass); $instance->bindings = $bind->getBindings(); return $instance; });
  5. σϑΥϧτͰ༻ҙ͞ΕͨΞϊςʔγϣϯ • @Transactional (Ξϥ΢ϯυΞυόΠε)
 ΞϊςʔγϣϯΛهड़ͨ͠ϝιουͷॲཧத͸
 σʔλϕʔεͷτϥϯβΫγϣϯΛ࣮ߦ͢Δ • @Loggable (Ξϥ΢ϯυΞυόΠε)
 ΞϊʔςʔγϣϯΛهड़ͨ͠ϝιουͷ࣮ߦ࣌ؒɺ


    Ҿ਺ɺ໭Γ஋ΛϩΪϯά • @LogExceptions (ΞϑλʔΞυόΠε)
 ΞϊςʔγϣϯΛهड़ͨ͠ϝιουͰ
 ΤΫηϓγϣϯ͕εϩʔ͞Εͨ৔߹ʹҾ਺ΛϩΪϯά
 ͦͷ··ϋϯυϥʔ΁εϩʔ͢Δ
  6. ࣮ࡍʹ࢖ͬͨྫ • @Meta (ΞϑλʔΞυόΠε)
 Template΁metaλάΛૠೖ(canonical΍pageͳͲ) • @Cacel (ΞϑλʔΞυόΠε)
 ಛఆͷ৚݅ԼͰ༧໿ͷΩϟϯηϧΛߦ͏ •

    @PThread (Ξϥ΢ϯυΞυόΠε)
 ผεϨουͰ֘౰ͷϝιουΛ࣮ߦ͢Δ • @Queue (Ξϥ΢ϯυΞυόΠε)
 ΞϊςʔγϣϯͰࢦఆ͞ΕͨϝιουͷॲཧΛ
 QueueʹೖΕΔ